You'll have to be more specific about what you are trying to do. Does SOMEFIELD appear in one row of a report, but not in another based on the value of FIELD2 for that row? If so, that can be done with a COMPUTE. Or, is FIELD2 evaluated just once for the report? If so, SOMEFIELD can be added or not added by Dialogue Manager.
If your are trying to prevent field two from showing on the report completely based on another value from a field, you will need to use a table request to retrieve the value to be checked and read it into a dialog manager variable. You would then use the dialog manager variable with an if statement to print the field.
If you don't mind that a column on the report is reserved for the field, then you could set the value to a blank when the condition is true (or false) using a define or compute.
I have so many fields in a row, and i need to show some fields based on a field FIELD3 as below.
so based on the value of field3 I need to disply some fields, but the rest of the fields are displayed with no condition. All my fields are coming from MYFILE
TABLE FILE MYFILE
PRINT
FIELD1 OVER
FIELD2 OVER
IF FIELD3='SOMETHING' THEN PRINT FIELD4 AS 'SOMENAME'
ELSEIF FIELD3='SOMETHINELSE' THEN PRINT FIELD5 AS 'SOMENAME'
ELSEIF FIELD3='SOMEOTHER' THEN PRINT FIELD6 AS 'SOMENAME'
...
...
END
Can we print/display fields on based on some conditions (IF THEN ELSEIf...)??
-P
COMPUTE NEWFLD/A20 = IF FIELD3 EQ 'SOMETHING' THEN FIELD4
ELSE IF FIELD3 EQ 'SOMETHINELSE' THEN FIELD5
ELSE IF FIELD3 EQ 'SOMEOTHER' THEN FIELD6;
AS 'SOMENAME'
Another option (if you need to display FIELD4 and FIELD5 if FIELD3 = 'SOMETHING' would be to use subfoots since you are using OVER. Remove the last OVER statement and make FIELD3 the last by field with a NOPRINT and use --
ON FIELD3 SUBFOOT
"<FIELD4"
WHEN FIELD3 EQ 'SOMETHING'
ON FIELD3 SUBFOOT
"<FIELD5"
WHEN FIELD3 EQ 'SOMETHING' OR 'SOMETHINELSE'
ON FIELD3 SUBFOOT
"<FIELD6"
WHEN FIELD3 EQ 'SOMEOTHER'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.