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
Best answer by Jonas Feigl
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.
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.