Page 1 of 1

(RPG) Using a "P" field to control other fields' appearance

Posted: Fri Aug 24, 2012 4:02 pm
by Mark_Dale
If you want to change the appearance of a group of fields with a single instruction on the server you can use a program-to-system field:


You can define a ‘program-to-system field’ in IBM i display file DDS like this:

Code: Select all

     A* Define the form view record format
     A          R FORMVIEW
     A* Variable HTML content is a type “P” field in DDS 
     A            HTMLVARTAG    50A  P
 
Then repeatedly reference it in HTML tags like this ........

Code: Select all


     A                                 9  2'Dep Rate'
     A                                 9  2HTML(&HTMLVARTAG)
     A*  
     A                                 9 20'11.75'
     A                                 9 20HTML(&HTMLVARTAG)
     A* 
     A                                 10  2'Dep Cycle'
     A                                 10  2HTML(&HTMLVARTAG)
     A* 
     A                                10 20'QUARTERLY'
     A                                10 20HTML(&HTMLVARTAG)
 
Then in your RPG code you can do this .........

Code: Select all

      If (something);
         HtmlVartag = ‘Color:Red Font.Bold:True’    
      Else;
         HtmlVartag = ‘Color:Blue’    
      Endif;