Mo.Saber
22nd September 2022, 15:23
I am creating a calculated field for my report and want to add an IF condition in my query. However, neither the SQL format nor the Oracle SQL format is working.

mark_h
23rd September 2022, 14:46
Where are you doing the calculated field? Is this easy-sql, in a session or in a report script? What have you tried so far. I mean in a report field I have done stuff like total.hrs=0 ? 0.0 : past.due.hrs / total.hrs * 100 not sure what you are looking for.

Mo.Saber
5th October 2022, 00:52
I tried to do that in the Purchase Order report (tdpur440101000) where I want to print a certain calculated field if the tax code is 007 and a different calculated field if it is not. I did this:
tdpur401.cvat="007" ? ext.tax1 : ext.tax2
However, it always results in false (prints tax2) even though that tax code is clearly 007 and is printed in the report as such

mark_h
5th October 2022, 15:58
In 4c4 cvat is 9 characters long and right justified. You could try something like shiftl$ - but make sure cvat is only "007" and not really something else. Plus on my 4v4 I have cvat in tdpur041 not tdpur401 - but looks like you are on a different version.

bdittmar
5th October 2022, 18:51
I tried to do that in the Purchase Order report (tdpur440101000) where I want to print a certain calculated field if the tax code is 007 and a different calculated field if it is not. I did this:
tdpur401.cvat="007" ? ext.tax1 : ext.tax2
However, it always results in false (prints tax2) even though that tax code is clearly 007 and is printed in the report as such

Hello, try
trim$(tdpur401.cvat)="007" ? ext.tax1 : ext.tax2

And tdpur401 is the right table (purchase positions) in LN.

Regards

mark_h
5th October 2022, 23:12
Thanks Bernd.

Mo.Saber
6th October 2022, 03:10
Hello, try
trim$(tdpur401.cvat)="007" ? ext.tax1 : ext.tax2

And tdpur401 is the right table (purchase positions) in LN.

Regards

This works! Thank you so much.