Solved

Counting Values on Custom Page

  • 30 August 2023
  • 6 replies
  • 92 views

Userlevel 6
Badge +19
  • Superhero (Partner)
  • 542 replies

Hello experts,

I created a new custom LU with couple of fields. One of them is checking duplicate values.

These are my custom LU columns. Please see the SQL code for DUPLICATE column.

 

When I run query on SQL query tool I got the number. Please see below

 

 

But on custom page the number is 0 although the query is the same. What could be wrong.

 

 

thanks

icon

Best answer by Jonas Feigl 31 August 2023, 19:28

View original

6 replies

Userlevel 5
Badge +9

@gumabs 

I have a feeling this might have to do with the datatype you selected for this duplicate field. 

Can you check if its a number?

Cheers

Userlevel 6
Badge +19

Hi @EntNadeeL 

Thanks for input. The data type was text and I changed to number. Then refreshed page layout. However the formula is not calculating after the change

Userlevel 5
Badge +9

@gumabs 

Have you synchronized the logical unit after changing.?

Cheers

Userlevel 6
Badge +19

Hi @EntNadeeL 

Yes, I did synchronize but it does not work

Userlevel 5
Badge +17

I suspect that you have defined the fields “INVOICE_NO” and/or “SUPPLIER” as Persistent Custom fields of type “Reference”? If so you have to check the _DB column instead:

  • WHERE cf$_supplier_db = :cf$_supplier AND cf$_invoice_no_db = :cf$_invoice_no

The reason is the following:

  • For Persistent Custom Fields of type “Reference” the table (_CFT, _CLT) stores the ROWKEY of the referenced record rather than the actual key you are referencing. The ROWKEY is a GUID, i.e. a ‘random’ string of characters and numbers.
  • In the corresponding view (_CFV, _CLV) you then get two columns, a _DB column (e. g. “CF$_SUPPLIER_DB”) which shows the ROWKEY value from the table and the standard column (“CF$_SUPPLIER”) which shows the now converted user friendly value (i.e. the supplier id).
  • As the parameters (:CF$_SUPPLIER / t.CF$_SUPPLIER) come from the table these will contain the ROWKEY
  • Your select statement has its WHERE condition on the view though where it then contains the converted (user friendly) key value. 
  • To fix this you can either change your select statement to select from the table (“i_n_v_r_e_g_clt”) or select form the _db column.

 

Hope this helps!

Userlevel 6
Badge +19

Hi @Jonas Feigl 

Thanks for reply. I changed query to table and it worked. Thanks for detailed explanation. I understand the logic behind now.

 

 

@EntNadeeL thanks again for your input and correcting me for data type.

 

Regards

Reply