270 likes | 402 Views
Supercharge Your Parameterized HTML Launch Pages With 7.6.9+ Advanced Chaining Techniques!. Dan Pinault Power Systems Research. Basic Chaining in HTML Composer. What is Chaining?.
E N D
Supercharge Your Parameterized HTML Launch Pages With 7.6.9+ Advanced Chaining Techniques! Dan Pinault Power Systems Research
What is Chaining? • A method of selectively reducing the number of options in ‘downstream’ controls based on selections made in ‘upstream’ controls. • Typically used with data fields that have a hierarchical or one-to-many relationship (does not imply data file structure) • Prevents users from making selections that will not return any data [i.e. (Region EQ ‘Central Asia’) and (Country EQ ‘United States’)]
Advanced chaining technique – Step1 This drop-down list allows the user to select one of the Master Files they have access to.
Let’s take a closer look – Data Source Selector -* Code to populate combobox1 Data Source Dropdown List control. -* Use value of &&IBI_IF_FILE to create list of available Master Files. -* Need to evaluate &&IBI_IF_FILE before TABLE Request because Dialog -* Manager command -INCLUDE can not evaluate variable inside TABLE Request. -SET &FILELIST = '-INCLUDE ' | &&IBI_IF_FILE; TABLE FILE SYSTABLE SUM FST.REMARKS BY NAME &FILELIST.EVAL ON TABLE PCHOLD FORMAT XML END
Advanced chaining technique – Step2 The values in this drop-down list are determined by the Master File selected in the Data Source Selector.
Let’s take a closer look – Field Name Selector -* Code to populate combobox2 Field Name Dropdown List control. -* Default Amper-Variables because list will populate when HTML page loads. -DEFAULT &DATASOURCE = SUMMIT2010DATA; CHECK FILE &DATASOURCE HOLD AS DS_HLD TABLEF FILE DS_HLD SUM FST.TITLE BY FIELDNAME ON TABLE PCHOLD FORMAT XML END
Advanced chaining technique – Step3 The values in this list-box are determined by the selected item in the Field Name Selector.
Let’s take a closer look – Data Value Selector -* Code to populate listbox1 Data Values List control. -* Set ASNAMES on to allow for custom data field and display field. SET ASNAMES = ON -* Default Amper-Variables because list will populate when HTML page loads. -DEFAULT &DATASOURCE = SUMMIT2010DATA; -DEFAULT &FIELDNAME = REGIONNAME; TABLE FILE &DATASOURCE SUM FST.&FIELDNAME AS FIELDVALS BY &FIELDNAME AS FIELDVALS ON TABLE PCHOLD FORMAT XML END
Advanced chaining technique – Step4 Adding the Guide Words Selector allows the user to ‘page’ through a long list of Data Values in the Data Value Selector.
Let’s take a closer look – Guide Words Selector (1 of 3) -* Code to populate combobox3 Guide Words Dropdown List control -* Default Amper-Variables because list will populate when HTML page loads. -DEFAULT &DATASOURCE=SUMMIT2010DATA; -DEFAULT &FIELDNAME=REGIONNAME; -DEFAULT &BLOCKSIZE=500; -DEFAULT &BLOCK=0; -* First pass assigns each row to a block number based on the value of &BLOCKSIZE. TABLE FILE &DATASOURCE SUM COMPUTE ROWNUM/I7 = LAST ROWNUM-(-1); COMPUTE BLOCK /I5 = 1-(-(INT((ROWNUM-1)/&BLOCKSIZE))); BY &FIELDNAME WHERE &FIELDNAME IS NOT MISSING; ON TABLE HOLD AS FOCCACHE/HOLDKEYS END -RUN
Let’s take a closer look – Guide Words Selector (2 of 3) -* Second pass is to get the format of the selected field so we can determine how -* to convert the values to a string format so the values can be concatenated. CHECK FILE &DATASOURCE HOLD AS DS_HLD TABLE FILE DS_HLD SUM FST.FORMAT WHERE FIELDNAME EQ '&FIELDNAME'; ON TABLE SAVE END -RUN -* Put the field format value into &FIELDTYPE and convert field value to string. -READ SAVE &FLDTYPE.A8. -SET &FLDINIT = EDIT(&FLDTYPE,'9$'); -SET &XFIELD = - IF (&FLDINIT EQ 'I') THEN 'EDIT(&FIELDNAME.EVAL)' - ELSE IF (&FLDINIT EQ 'P') THEN 'PTOA(&FIELDNAME.EVAL, ''(&FLDTYPE.EVAL)'', ''A99V'')' - ELSE IF (&FLDINIT EQ 'D' OR 'F') THEN 'FTOA(&FIELDNAME.EVAL, ''(&FLDTYPE.EVAL)'', ''A99V'')' - ELSE '&FIELDNAME.EVAL';
Let’s take a closer look – Guide Words Selector (3 of 3) -* Remove leading zeros if they exist. DEFINE FILE FOCCACHE/HOLDKEYS FLDNAM/A99V = (TRIMV('L', &XFIELD, 99, '0', 98, 'A99V')); END TABLEF FILE FOCCACHE/HOLDKEYS SUM FST.ROWNUM AS LOROW NOPRINT LST.ROWNUM AS HIROW NOPRINT -* Build Guide Words entry from first and last FLDNAM in each block. COMPUTE RANGE/A99V = IF (LST.ROWNUM GT FST.ROWNUM) THEN FST.FLDNAM || ' ~ ' | LST.FLDNAM ELSE FST.FLDNAM; BY BLOCK ON TABLE SET HOLDLIST PRINTONLY AND ASNAMES ON ON TABLE PCHOLD FORMAT XML END
Let’s take a closer look – Data Value Selector (v2) -* Code to populate listbox1 Data Values List control when used with Guide Words control. -* Set ASNAMES on to allow for custom data field and display field. SET ASNAMES = ON -* Default Amper-Variables because list will populate when HTML page loads. -DEFAULT &FIELDNAME = REGIONNAME; -DEFAULT &BLOCK = 1; TABLEF FILE FOCCACHE/HOLDKEYS SUM FST.&FIELDNAME AS FIELDVALS BY &FIELDNAME AS FIELDVALS WHERE BLOCK EQ █ ON TABLE PCHOLD FORMAT XML END
Questions? Dan Pinault dpinault@powersys.com