Hi all,
In a report I want to print a text if 1 of the articles in the order contains a certain Item Category Code.
Example order with these items:
Item No. Item Category Code
10000 X
10010 Y
10020 Z
If 1 of these items contains the code X, the text must be printed, otherwise not. In this case, the text must be printed.
I had thought to make this work with this code:
IF SalesLine."Item Category Code" = 'X' THEN
gPrintTextA := TRUE
ELSE
gPrintTextA := FALSE;
Unfortunately this code doesn't work. What am I doing wrong?
Answers
My knowledge is not so great that I can translate this to my situation.
By the way, I chose to set the value of a boolean to TRUE and then display the textbox at that value in the report builder because the text is formatted.
It now looks like this code looks at the first position?
I am looking for a solution when one of the Sales Lines in an order has Item Category Code 'X' then the boolean must be set to TRUE.
Then forget about STRPOS, your code should be fine and the problem is somewhere else.
Just pure guessing: The variable is not really global, or it is not reset every time (if needed), check your DataSet result (with Ctrl + Alt + F1), try to debug it, put some messages to check variable value...
There are multiple ways, or we need to see how the entire solution looks like, those 4 lines is not enough.
This is the Dataset of the Report:
These are the Global Variables:
I have added the field 'PrintTextA' in the Layout so that I can see if it is set to TRUE.
I've put the code in the 'Configuration - OnAfterGetRecord()'
That`s weird, man! I don`t know, debugging didn`t help?