cancel
Showing results for 
Search instead for 
Did you mean: 

Formatted Search Query in SAP B1

joseih
Explorer
0 Kudos

I have this querry
SELECT DISTINCT CURRENT_DATE AS "Current_Date" FROM ORDR
That i will put in a date type field.
But i want only this querry to trigger when she's empty. How do i do that?

CharlesFeng
Advisor
Advisor
0 Kudos

Hi joseih,

I tried to understand your questions by reading it multiple times, but it is still not clear to me.
Could you please explain it in more details? Maybe an example will be helpful for us to understand.

Best regards,
Charles

joseih
Explorer
0 Kudos

Sorry Charles!
Basically i created a field in SAP B1 that indicates the month of the document, here in Brasil is a crucial thing to have. But, everytime i open a marketing documment, this field is empty, so, i wanted to have a querry that will give me the current date.
Thank you!

Accepted Solutions (1)

Accepted Solutions (1)

yogananda
Product and Topic Expert
Product and Topic Expert

joseih

You can use an IF statement in your SQL query to check if the date field is empty. If it is empty, then the query will execute, otherwise it won't.

Example:

IF NOT EXISTS (SELECT CURRENT_DATE FROM ORDR WHERE date_field IS NULL) 
    SELECT DISTINCT CURRENT_DATE AS "Current_Date" FROM ORDR;

Answers (0)