Focal Point
Dynamic selectedvalue for XML

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3767086616

February 15, 2012, 08:20 AM
Tom Flynn
Dynamic selectedvalue for XML
Has anyone discovered how to dynamically designate a value as a default to populate a combobox with PCHOLD FORMAT XML?

I see how the code is generated by "hard-coding" within the GUI, and, we do have the value generated into an ampere value, &TERM:

Hard-Coding a value, works:
  
<input_controls>
 
<input_control bindcontrolid="compUid_4" elementtype="8" name="combobox1" id="combobox1" multiple="0" top="20" 
left="30" width="60" height="20" inbinding="1" unresolved="0" textvarname="_TEXT" onetimepopulated="0">
 
<link linktype="default">
 
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
 
<data_info sourcetype="typeFex" datatype="1" selectedvalue="201220" datasource="stu_get_terms_tom.fex"
 displayfield="SHOW_TERM" datafield="X_STVTERM_CODE" ibiapp_app="ban_stu" modifiedrequest="1">
 
<![CDATA[]]></data_info></condition></link></input_control></input_controls>


Using an ampere, does not work:
  
<input_controls>
 
<input_control bindcontrolid="compUid_4" elementtype="8" name="combobox1" id="combobox1" multiple="0" top="20" 
left="30" width="60" height="20" inbinding="1" unresolved="0" textvarname="_TEXT" onetimepopulated="0">
 
<link linktype="default">
 
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
 
<data_info sourcetype="typeFex" datatype="1" selectedvalue="!IBI.AMP.TERM;" datasource="stu_get_terms_tom.fex"
 displayfield="SHOW_TERM" datafield="X_STVTERM_CODE" ibiapp_app="ban_stu" modifiedrequest="1">
 
<![CDATA[]]></data_info></condition></link></input_control></input_controls>

Any help, appreciated...

Tom

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
February 15, 2012, 09:01 AM
Tom Flynn
Never mind, figured out. Put it into a global var and that works:

  
TABLE FILE STVTERM
SUM
    SHOW_TERM
  BY X_STVTERM_CODE
WHERE FLAG1 EQ 'Y';
  ON TABLE SAVE
END
-RUN

-READ SAVE &&TERM.A6. &&TERM_DESC.A40.
-CLOSE SAVE
-RUN
TABLE FILE STVTERM
SUM
    SHOW_TERM
  BY X_STVTERM_CODE
  ON TABLE PCHOLD FORMAT XML
END
-RUN


Put the global into the Selected Value in the GUI:

Selected Value !IBI.GLB.TERM;


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
February 15, 2012, 10:12 AM
njsden
Cool! Thanks for sharing that tip. It may certainly come in handy.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
February 15, 2012, 03:16 PM
Tom Flynn
Thanks njsden!

Unfortunately, it is interpreted and rendered "correctly" in 7.6.11. When looking at the source,
selectedvalue="201220" is displayed, again, correctly, which is the value of &&TERM.

Just off the phone, and a WebEx, with a client who has 7.7.03, and, in viewing the source, 7.7.03 actually puts
selectedvalue="!IBI.GLB.TERM;" and it is "NOT" rendered correctly. I am perceiving this as a 7.7.03 bug.

If there is anyone on 7.7.03, and, are doing a dynamic fex to populate combo/list boxes, can you test this concept?

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
February 15, 2012, 05:54 PM
Dan Satchell
If the HTML page does not use -HTMLFORM, the use of bang variables (!IBI.AMP.varname) will not work. I discussed a work-around for this issue in an earlier post: Pre-select value in dynamic drop-down


WebFOCUS 7.7.05
February 16, 2012, 08:39 AM
Tom Flynn
Hi Dan, Thanks for the delving into ibirls3 and being creative.

In all earlier 7 versions, we have used !IBI.AMP.VAR; and !IBI.GLB.VAR; without the use of -HTMLFORM, so, I disagree with the assertion that they must be used in conjunction.

It seems to me that in 7.7, it is now a literal component, i.e., text, where it was interpreted prior.

We'll open a case...

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
February 17, 2012, 01:15 PM
Brian Suter
Tom,
Not sure how you got !IBI.AMP to work ... that substitution is done by the code in the -HTMLFORM command processor. Maybe you did not realize it was being invoked. Where is your HTML file stored and what URL fetched to your browser?


Brian Suter
VP WebFOCUS Product Development
February 20, 2012, 09:37 AM
Tom Flynn
Hi Brian,

Here is a simple example, Version 7.6.11:

Created a fex:
  
-SET &&COUNTRY = 'W GERMANY';
TABLE FILE CAR
SUM
   COUNTRY
  BY COUNTRY
 ON TABLE PCHOLD FORMAT XML
END
-RUN

Opened a new HTML and drag in a drop down box
In Parameters, select dynamic, external and the above fex.
In Selected Value, put in !IBI.GLB.COUNTRY;
Save the HTML...
Run it, and, W GERMANY is the selected value, it works fine...
Change the value to JAPAN, save, REFRESH Dev Studio, CLEAR your Browser cache, and, run the HTML - JAPAN is the Selected value...

In 7.7.03, it doesn't render the global value...

Look forward to your response...

FYI, since 2005-2006, we have used these in fex links to the HTML, using -INCLUDE html_pgm_name.htm

Tom

Edited to add the HTML Composer source and the View Source:

Composer Source code:
  
<!-- Generated by Report Layout Painter -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META id=mycharsetmeta content="text/html; charset=UTF-8" http-equiv=Content-Type>
<META id=Generation content="Created in release 7611, Generation 3.0">
<SCRIPT id=IBI_RelCallBack type=text/javascript>function AdjustChildrenPosition(){
}
</SCRIPT>
 
<SCRIPT id=IBI_OptionsScript type=text/javascript>
var cgipath = "cgipath";
var ibirls = "ibirls3";
 
var rltdyncalendar = "rltdyncalendar";
var gmap = "ibigmap";
var olap="olap";
var olappanebase="olappanebase";
var olapdrill="olapdrill";
 
var ibixmltree="ibixmltree";
 
var ibiOptions = new Array(cgipath,ibirls);
</SCRIPT>
 
<SCRIPT id=IBI_nls type=text/javascript src="/ibi_html/javaassist/nls.js"></SCRIPT>
 
<SCRIPT id=IBI_nlsVars type=text/javascript src="/ibi_html/javaassist/nlsvars.js"></SCRIPT>
 
<SCRIPT id=IBI_ibigbl type=text/javascript src="/ibi_html/javaassist/ibi/html/js/ibigbl.js"></SCRIPT>
 
<SCRIPT id=IBI_ibigblloadCss type=text/javascript>
ibigblloadCss(null);
addIntlTranslatedJS("composertrans.js");
</SCRIPT>
<TITLE>HtmlPage</TITLE>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {
 
UpdateData();
 
// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload
</SCRIPT>
 
<SCRIPT for=window eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
 
<META name=GENERATOR content="MSHTML 8.00.6001.19190"></HEAD>
<BODY style="OVERFLOW: auto" persistentuniqueid="compUid_1" nextelementuniquenumber="2" elementtype="21" edaconnectionrequired="true">
<SELECT style="Z-INDEX: 1; POSITION: absolute; WIDTH: 245px; TOP: 114px; LEFT: 185px" id=combobox1 tabIndex=1 persistentuniqueid="compUid_2" name="combobox1"></SELECT>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=layoutinfo type=hidden>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibiapp_app value=ban_stu type=hidden name="ibiapp_app">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibic_server value=EDASERVE type=hidden isdataserversarea="1" name="ibic_server">
<xml id=focus_xmlelement>
<script type="text/xml">
<rootxmlnode top="50" left="10" width="150" height="130">
<variables></variables>
<input_controls>
<input_control bindcontrolid="compUid_2" elementtype="8" name="combobox1" id="combobox1" multiple="0" top="20" left="30" width="60" height="20" 
inbinding="1" unresolved="0" onetimepopulated="0">
<link linktype="default">
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
<data_info sourcetype="typeFex" datatype="1" selectedvalue="!IBI.GLB.COUNTRY;" datasource="country_select.fex" displayfield="COUNTRY" datafield="COUNTRY" ibiapp_app="ban_stu">
<![CDATA[]]></data_info></condition></link></input_control></input_controls>
<other_bound_objects></other_bound_objects>
<requests></requests></rootxmlnode></script>
</xml></BODY>
<SCRIPT id=IBI_loader type=text/javascript>
doBeforeLoad();
</SCRIPT>
</HTML>

View Source output:
 
<!-- Generated by Report Layout Painter -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META id=mycharsetmeta content="text/html; charset=UTF-8" http-equiv=Content-Type>
<META id=Generation content="Created in release 7611, Generation 3.0">
<SCRIPT id=IBI_RelCallBack type=text/javascript>function AdjustChildrenPosition(){
}
</SCRIPT>
 
<SCRIPT id=IBI_OptionsScript type=text/javascript> 
var cgipath = "cgipath";
var ibirls = "ibirls3";
 
var rltdyncalendar = "rltdyncalendar";
var gmap = "ibigmap";
var olap="olap";
var olappanebase="olappanebase";
var olapdrill="olapdrill";
 
var ibixmltree="ibixmltree";
 
var ibiOptions = new Array(cgipath,ibirls);
</SCRIPT>
 
<SCRIPT id=IBI_nls type=text/javascript src="/ibi_html/javaassist/nls.js"></SCRIPT>
 
<SCRIPT id=IBI_nlsVars type=text/javascript src="/ibi_html/javaassist/nlsvars.js"></SCRIPT>
 
<SCRIPT id=IBI_ibigbl type=text/javascript src="/ibi_html/javaassist/ibi/html/js/ibigbl.js"></SCRIPT>
 
<SCRIPT id=IBI_ibigblloadCss type=text/javascript> 
ibigblloadCss(null);
addIntlTranslatedJS("composertrans.js");
</SCRIPT>
<TITLE>HtmlPage</TITLE>
<SCRIPT id=clientEventHandlersJS type=text/javascript> 
//Begin function window_onload
function window_onload() {
 
UpdateData();
 
// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload
</SCRIPT>
 
<SCRIPT for=window eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
 
<META name=GENERATOR content="MSHTML 8.00.6001.19190"></HEAD>
<BODY style="OVERFLOW: auto" persistentuniqueid="compUid_1" nextelementuniquenumber="2" elementtype="21" edaconnectionrequired="true">
<SELECT style="Z-INDEX: 1; POSITION: absolute; WIDTH: 245px; TOP: 114px; LEFT: 185px" id=combobox1 tabIndex=1 persistentuniqueid="compUid_2" name="combobox1"></SELECT>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=layoutinfo type=hidden>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibiapp_app value=ban_stu type=hidden name="ibiapp_app">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibic_server value=EDASERVE type=hidden isdataserversarea="1" name="ibic_server">
<xml id=focus_xmlelement>
<script type="text/xml">
<rootxmlnode top="50" left="10" width="150" height="130">
<variables></variables>
<input_controls>
<input_control bindcontrolid="compUid_2" elementtype="8" name="combobox1" id="combobox1" multiple="0" top="20" left="30" width="60" height="20" 
inbinding="1" unresolved="0" onetimepopulated="0">
<link linktype="default">
<condition default="1" name="Default" whattodowithcontrol="0" valuescompareoperator="0" parameterscompareoperator="0" conditionmultiselectoperator="0">
<data_info sourcetype="typeFex" datatype="1" selectedvalue="W GERMANY" datasource="country_select.fex" displayfield="COUNTRY" datafield="COUNTRY" ibiapp_app="ban_stu">
<![CDATA[]]></data_info></condition></link></input_control></input_controls>
<other_bound_objects></other_bound_objects>
<requests></requests></rootxmlnode></script>
</xml></BODY>
<SCRIPT id=IBI_loader type=text/javascript> 
doBeforeLoad();
</SCRIPT>
</HTML>
 
<!--
 
-->

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
February 20, 2012, 10:54 AM
j.gross
If (per Brian) you have to have a wrapper fex with -HTMLFORM in order for !IBI...; substitution to take place, and (per Tom) the GLB flavor is broken in 7.7.03, you can just localize the global variable in the wrapper fex:

---

In the driver fex
-SET &&myvar =...;
EX mypage

In mypage.fex (the wrapper),
-SET &myvar=&&myvar;
-HTMLFORM mypage.HTM

In mypage.HTM
imbed !IBI.AMP.myvar; as needed

---


- Jack Gross
WF through 8.1.05
February 22, 2012, 04:33 AM
Kofi
Tom,

This may be work in 7.6 versions but is document showing this use? If no document show this then might not always work for future.

One method in use by me is to place value you require first and then inner code seem to remove next occurence like remove duplicate.

As contain this is in focexec then GUI no problem just dynamic and choose focexec in list.

-*-SET &ECHO = ALL;
SET MSG = OFF
-DEFAULT &FrMnth = 012010
FILEDEF TOMNTHS DISK TOMNTHS.FTM (APPEND
-RUN
DEFINE FILE DATERNG
  MNTHYEAR/I6MYY = &FrMnth;
  BASEMNTH/MYY   = DATECVT(AYM(DATECVT(MNTHYEAR,'I6MYY','I6YYM'), 3, 'I6YYM'),'I6YYM','I6MYY');
  HIGHMNTH/MYY   = DATECVT(AYM(DATECVT(MNTHYEAR,'I6MYY','I6YYM'), 11, 'I6YYM'),'I6YYM','I6MYY');
END
TABLE FILE DATERNG
  SUM FST.MNTH_DISPLAY
      COMPUTE SORT/I2 = 1;
   BY HIGHEST 1 MNTH_KEY
WHERE MNTH_KEY GE BASEMNTH
WHERE MNTH_KEY LE HIGHMNTH
ON TABLE HOLD AS TOMNTHS FORMAT ALPHA
END
TABLE FILE DATERNG
  SUM FST.MNTH_DISPLAY
      COMPUTE SORT/I2 = 9;
   BY MNTH_KEY
WHERE MNTH_KEY GE BASEMNTH
WHERE MNTH_KEY LE HIGHMNTH
ON TABLE PCHOLD FORMAT XML
ON TABLE HOLD AS TOMNTHS FORMAT ALPHA
END
TABLE FILE TOMNTHS
  SUM FST.MNTH_DISPLAY
   BY SORT NOPRINT
   BY MNTH_KEY
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE PCHOLD FORMAT XML
END


Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
February 22, 2012, 11:20 AM
Tom Flynn
Hi Kofi,

Yes, we already do that(see below), but, the client has requested that they be in chronological order;
using the global variable does that...

Thanks for your input...

Hi Jack,

Then we have to train the users to use HTML wrappers, while, IBI continues to champion the GUI.
Seems to have been an overlooked process in IBIRLS3 that has been removed;
Why hard-code a Selected Value? Why wouldn't it be dynamic? Etc...

Still hoping to hear from Brian...

Tom

  
DEFINE FILE STVTERM
   START_DT/YYMD      = STVTERM_START_DATE;
   START_YR/YY        = DATEADD(START_DT, 'Y', -1);;
   END_DT/YYMD        = STVTERM_END_DATE;
   XEND_DT/YYMD       = DATEADD(END_DT, 'D', 1);
   XEND_YR/YY         = DATEADD(END_DT, 'Y', 2);
   XTODAY/YYMD        = &YYMD;
   X_TODAY_YR1/YY     = DATEADD(XTODAY, 'Y', -4);
   X_TODAY_YR2/YY     = DATEADD(XTODAY, 'Y',  4);
   FLAG1/A1           = IF XTODAY   GE START_DT   AND XTODAY   LE XEND_DT     THEN 'Y' ELSE 'N';
   FLAG2/A1           = IF START_YR GE X_TODAY_YR1 AND XEND_YR LE X_TODAY_YR2 THEN 'Y' ELSE 'N';
   X_STVTERM_CODE/A6  = STVTERM_CODE;
   X_STVTERM_DESC/A30 = STVTERM_DESC;
   SHOW_TERM/A40      = X_STVTERM_CODE || ' - ' | X_STVTERM_DESC;
END
TABLE FILE STVTERM
SUM
  X_STVTERM_CODE
WHERE FLAG1 EQ 'Y';
 ON TABLE SAVE
END
-RUN
-READ SAVE &CUR_TERM_YR.A4.
-TYPE &CUR_TERM_YR
DEFINE FILE STVTERM ADD
   SORT1/A4           = EDIT(X_STVTERM_CODE,'9999');
   SORT2/A1           = IF FLAG1 EQ 'Y' THEN '1' ELSE
                        IF SORT1 EQ '&CUR_TERM_YR' THEN '2' ELSE '3';
END
TABLE FILE STVTERM
SUM
    SHOW_TERM
  BY HIGHEST FLAG1 NOPRINT
  BY SORT2 NOPRINT
  BY X_STVTERM_CODE
 WHERE X_STVTERM_DESC OMITS 'CEU' OR 'BiMBA' OR 'FA';
 WHERE FLAG2 EQ 'Y';
  ON TABLE PCHOLD FORMAT XML
END
-RUN



Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe