Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add #safeLongName

...

  • #field – Field name. If a file's field has a long alias, then the Jumpstart UI fills the input box in "Field Selection" with the long field name. The Jumpstart user may specify an alternate name in the Field Selection interface, in which case, #field is not the same as the database field name.
  • #fieldxxxxx – Same as #field, but padded with spaces to 11 characters if the value of #field has fewer than 11 characters. If the value of #field has more than 11 characters, then #fieldxxxxx is a the value of #field truncated to 11 characters. #fieldxxxxx can be used on a fixed format D specification in RPG if #field has 11 or fewer characters.
  • #fieldLC – Same as #field, except all characters are lowercase.2
  • #dbfield - The database field name. Often the same as #field, unless the user chose a different field name¹, or unless the database field name has a long alias. #dbfield is never the long name alias–it is always the shorter name.
  • #dbfieldxx - The database field name padded with spaces to 10 characters. If the field name has a long alias, this is the short database name. Useful for fixed form RPG.
  • #dbfieldLC – Same as #dbfield, except all characters are lowercase.2
  • #description – Field description as specified by the user (initially retrieved from the database)
  • #type – Field type; for example: A for alphanumeric
  • #varlenind – Variable field length indicator: 1 if the field has a variable length, 0 otherwise.4
  • #length – Field length
  • #decimals – Field decimal positions
  • #key (boolean) – Set to true if selected as a unique key field in the JumpStart interface
  • #grid (boolean) – Set to true if selected as a grid field in the JumpStart interface
  • #search (boolean) – Set to true if selected as a search field in the JumpStart interface
  • #details (boolean) – Set to true if selected as a details field in the JumpStart interface
  • #view (boolean) – Set to true if selected as a view field in the JumpStart interface
  • #edit (boolean) – Set to true if selected as an edit field in the JumpStart interface
  • #readOnly (boolean) – Set to true if selected as a read only field in the JumpStart interface
  • #add (boolean) – Set to true if selected as an add field in the JumpStart interface
  • #index – The field index; 1 for first field, 2 for second field, etc.
  • #first (boolean) – Set to true if this is the first field in the loop
  • #last (boolean) – Set to true if this is the last field in the loop
  • #longName - the long SQL field name or Alias name; if the field doesn't have a long name, this variable will return the same value as #dbfield, or the standard/short field name. If the user did not change the value of the field name (#field), and if the field name isn't long, then #dbfield is the same as #field.
  • #safeLongName - In most cases, this will be identical to #longName. If #longName contains a value that is unusable in RPG variables, however, then #safeLongName will return the same value as #dbfield.5
  • #generatedAlways (boolean) - Set to true if this field is always auto-generated by the SQL engine
  • #generatedByDefault (boolean) - Set to true if this field auto-generated by the SQL engine by default but can still be overridden to a different value by the application
  • #use - Specified whether the field is I (input), O (output), B (both) or N (neither)
  • #parentFile - the file to which the current field belongs. ¹
  • #parentFullFile - the library and file to which the current field belongs.¹
  • #parentCorrel - The user-specified correlation value for the field's file. Empty if not specified.¹
  • #coalesceVal - The user-specified value to use as the second argument in a COALESCE SQL function. Empty if not-specified.¹

¹ 1 Available in Version 5, Fix Pack 8.0 and later.

...

4 Available in Version 6, Fix Pack 4.0 and later.

5 Available in Version 6, Fix Pack 16.0 and later.

Conditional Expressions

...

Code Block
             If Table_Out.CNAME <> Table_In.CNAME
             OR Table_Out.CIMG <> Table_In.CIMG
             OR Table_Out.CSPEC <> Table_In.CSPEC ;
               doupdate = *on;
             EndIf;

 


File Loop

Profound UI Version 5, Fix Pack 8.0 supports selecting multiple files in JumpStart. The following loop is available for iterating over files:

...

Code Block
dcl-proc JMPSTR001_GetData;
  //...
end-proc;

 


Macro expressions are evaluated after the template pre-processor removes comments and processes variables, for-loops, else-, and if-statements.

...

Code Block
         EXEC SQL DECLARE C1 CURSOR FOR
           SELECT                      
           PRODP.PRID ,                
           PRODP.PNAME ,               
           PRODP.PPRICE ,              
           PRODP.PIMG                  

...


*#eval() is available with Profound UI Version 5, Fix Pack 7.0 and later; #evalQ() is available with Version 5, Fix Pack 8.0 and later.

...

Code Block
languagejavascript
titleWith Append
  function Show_Detail(KeyCATID, Mode, notFound) 
  {

...


RPG and Universal Display File Template Directives

...

After a user clicks "Generate Application" in Jumpstart and no key fields were chosen, then the code above stops the generator and displays an alert:

 


Example Template Notice:

Code Block
{
#for each field chosen
#if (#index <= 2)
#eval(#index > 1 ? "," : "") "#field": "[#field]"
#else
#tpltNotice('Hint: only the first two fields chosen in Field Selection are used with an Autocomplete template: the first is the value. If the JSON includes a second field, that value becomes a label in the auto-complete results.')
#endif
#endfor
}

...

And specifying "JumpStart App" in the Application Title sets the description to "JumpStart App (RDF)":

 


Adapting Templates for Multiple Files, Joins, Correlations, Coalesce

...

Code Block
       Dcl-DS Tmplt_PRODP EXT qualified template                                                    
         ExtName('PUISAMPLES/PRODP') ALIAS                                                          
       End-DS;                                                                                      
       Dcl-DS Tmplt_CATEGP EXT qualified template                                                   
         ExtName('CATEGP') ALIAS                                                                    
       End-DS;                                                                                      
                                                                                                    
       Dcl-DS Table_In qualified;                                                                   
         PRID Like(Tmplt_PRODP.PRID);                                                               
         PNAME Like(Tmplt_PRODP.PNAME);                                                             
         PPRICE Like(Tmplt_PRODP.PPRICE);                                                           
         CNAME Like(Tmplt_CATEGP.CNAME);                                                            
       End-Ds;                                                                                      
                                                                                                    
       Dcl-DS Table_Out LikeDS(Table_In);                                                           

 


Example Select-From-Join Generation

...

Code Block
EXEC SQL
  SELECT
    P.PRID ,
    P.PNAME ,
    P.PPRICE ,
    COALESCE(C.CNAME,'')
  INTO :Table_In
  FROM PUISAMPLES/PRODP P
  LEFT JOIN CATEGP C 
    ON P.PCATID = C.CATID 

...


The Standard.rpgle template installed with Profound UI fully supports these new features.

...