I’ve created a custom entity that has some SQL behind it that results in “0” or Greater than “0” as the output.
If it’s zero, I want the field to say “False” and if it’s not zero, it would say “True”.
What’s the best way to achieve this?
I’ve created a custom entity that has some SQL behind it that results in “0” or Greater than “0” as the output.
If it’s zero, I want the field to say “False” and if it’s not zero, it would say “True”.
What’s the best way to achieve this?
Hi
I'm unsure if this will completely cover every situation. I will describe 2 options.
Option 1:
If you want to stick to the 0/1:
I'm assuming that there will only be 2 statusses:
0 (false) and 1 (true).
Option 2:
If you don't specifically want to stick to the 0/1 statusses. There is a standard enumeration Named FndBoolean which contains True/False value.
Thanks for that, good response. I’ve tested that and it works OK.
I’ve heard that it’s possible to use a case statement too, would that be easy to achieve? In future I may have another scenario where I can’t use an enumeration.
So it would be something like, “SELECT…” if result is <1 then return “Inactive” ELSE “Active”.
I’m just not sure how to construct it.
Hi
It depends. If it is based on a diferent field that would be possible too. In that case you would have to create a read only field and the query would be
SELECT CASE WHEN :VARIABLE > 0 THEN ‘TRUE’ ELSE ‘FALSE’ END FROM DUAL
This is a dummy statement where you would have to replace the variable with your variable,
The argument is the column which is the field containing the 0/1. the argument could be v.customer_no (example). then the query would be “SELECT CASE WHEN :CUSTOMER_NO > 0 THEN ‘TRUE’ ELSE ‘FALSE’ END FROM DUAL “
Hi,
Yes, thanks. I’ve achieved it like this…
SELECT CASE WHEN isvalid = 1 THEN 'Yes' ELSE 'No' END AS RESULTS FROM ( SELECT ( COUNT(supplier_id) ) isvalid FROM supplier_info_address WHERE sysdate BETWEEN valid_from AND valid_to AND supplier_id = :supplier_id )
Thanks for your help :)
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.