hexagon logo

Comment controlled by variables

Hello All,

I am trying to make the following

K1 =COMMENT/YESNO,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
Has any allowance been made for reporting purposes?
ASSIGN/K2=K1.INPUTVALUE
IF_GOTO/K2==2,GOTO = NO_TREATMENT
IF/K2==1
COMMENT/REPT,
******************************************
** REPORTING HAS ALLOWED FOR TREATMENTS **
******************************************
END_IF/
NO_TREATMENT=LABEL/

Although this works whenever i refresh the report page the comment comes up regardless of if i have yes or no selected. 

Can someone please help here? id like it so only if yes is selected can it show up on the report even if the report is refreshed

Parents Reply Children
  • K1 =COMMENT/YESNO,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
    Has any allowance been made for reporting purposes?
    ASSIGN/K2=K1.INPUTVALUE
    IF/K2==2
    ASSIGN/TOGGLE="$$"
    END_IF/
    IF/K2==1
    ASSIGN/TOGGLE="REPT"
    END_IF/
    COMMENT/TOGGLE,
    ******************************************
    ** REPORTING HAS ALLOWED FOR TREATMENTS **
    ******************************************
    Fixed. I forgot to add the quotation marks for the string values of the TOGGLE variable. This works when I tried it.

  • Awesome! Happy to help, and glad that worked for you!

    Secondary thought, but not necessary, instead of the "ASSIGN/K2=K1.INPUTVALUE", you can use the IF statements to handle this by using "IF/K1.INPUTVALUE==2" and later "IF/K1.INPUTVALUE==1". This should work just the same, and requires less actual coding, though in this case only removes one line of coding. Something to think about for future programming, just to be a bit more efficient and less coding to handle should the need arise to change anything in the future.

    Hope I explained that well! In your case though, I wouldn't worry about going back to change this, since its only the one extra line, just wanted to provide a more efficient approach, that could help with similar cases.