Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Create DD list from procedure using GUI

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Create DD list from procedure using GUI
 Login/Join
 
Guru
posted
Hi,
I'm trying to create a drop-down list in WF 7.1.1 HTML GUI using a dynamic procedure against CAR but the list is always empty.
What is the key that I'm missing?
I've read the docs on how to do this outside of the GUI but I want to do this using the GUI so I figure there must be something in the fex procedure that I need.

TIA
Greg

CAR.fex

TABLE FILE CAR
PRINT BODYTYPE
END
 
Posts: 274 | Location: Boston/New England | Registered: February 12, 2006Report This Post
Virtuoso
posted Hide Post
Create a procedure to build the dropdown list. The procedure should always have two columns. The first column is the value that will be sent to WF as the agrument, and the second will be displayed to the user. When finished, hold the data with PCHOLD FORMAT XML. You should run the request to ensure it works. What you should see is a XML document in you browser.

Example fex to load a drop down box.
TABLE FILE CAR
PRINT BODYTYPE
BY BODYTYPE
ON TABLE PCHOLD FORMAT XML
END

After you have confirmed the request, then go to your html layout tool, and create the drop down as dynamic procedure, and select your newly created procedure.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Member
posted Hide Post
Just thought I'd jump in here as this is an issue I've also been grappling with. Experiencing the same problems as Greg and have tried reading every class course textbook, online help and Focal Point submission that I could find. Various info found but no solutions yet. It must be simple but the answer is elusive.

Like Greg, want to do this as much as possible with GUI. I don't want a java solution (both data amounts and users are limited). Server calls should not be a problem. Just looking for simplicity and functionality.

I'm using 5.3.2; Self Service App; Project-Based development on XP.

When I try ON TABLE HOLD FORMAT ALPHA there are no results, other than a successful ftm/mas ; listbox is not populated. When trying the XML that Dhagen has recommended I get this:

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Only one top level element is allowed in an XML document. Error processing resource 'http://localhost/cgi-bin/ibi_cgi/ibiwe...


-^

Any suggestions?
 
Posts: 22 | Location: Waterbury VT USA | Registered: November 15, 2005Report This Post
Virtuoso
posted Hide Post
ON TABLE PCHOLD FORMAT XML

Note this is a PCHOLD not a HOLD!


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Member
posted Hide Post
ON TABLE PCHOLD FORMAT XML

...is indeed what I was trying, resulting in the above feedback. This was totally unexpected? Some setting wrong maybe?
Bill
 
Posts: 22 | Location: Waterbury VT USA | Registered: November 15, 2005Report This Post
Expert
posted Hide Post
Bill,

Some idea of the structure of your fex would help. An equivalent against the CAR or GGSALES file if you can, if not then just what you have.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Tony,
This is the fex code (begin):
-* File DMFORMPD1.fex
-* Default Mode: ResourceLayout
FILEDEF PAYFEED1 DISK C:\IBI\APPS\BASEAPP\PAYROLL_DATA\PAYFEED1.FTM
APP HOLD PRCOSTS

-* NEXT SECTION IS ONLY TEMPORARY: USED IN ORDER TO FORCE PARAMETERS WINDOW IN RESOURCE LAYOUT PAINTER
-DEFAULTS &PD1 = '$*';
TABLE FILE PAYFEED1
SUM PAYPER_AMT
WHERE PAYPERIOD EQ '&PD1';
BY PAYPERIOD
ON TABLE HOLD FORMAT ALPHA
END
-RUN
-* END OF TEMPORARY SECTION
FILEDEF PDLIST DISK C:\IBI\APPS\PRCOSTS\PDLIST.FTM
SET HOLDLIST=PRINTONLY
SET PAGE=NOPAGE
TABLE FILE PAYFEED1
SUM PAYPERIOD
BY PAYPERIOD
ON TABLE PCHOLD FORMAT XML
END
-HTMLFORM DMFORMPD1
End of fex code

As an incidental if you know of a better way to force Resource Layout Manager to show the parameters properties window, please let me know. The fex above works fine if I were to "HOLD FORMAT ALPHA". The XML results in the error described above.

What is a total failure is the htmlform. It will not pull in any data (in this case a list of paydates this fiscal year) even if we do use the alpha format.

I have come across documentation here and there suggesting that some versions of WF have a bug and will not support what I'm trying to do.

I'm maybe getting a little ahead of things here but if this were the case I'd really like to be directed to workable code. All I want is a dynamic list of paydates where I can select one of them only. The actual report request would then have the following appropriately resolved:
WHERE PAYPERIOD EQ '&PD1' ;

Thank you much for your consideration of this.
Bill
 
Posts: 22 | Location: Waterbury VT USA | Registered: November 15, 2005Report This Post
Virtuoso
posted Hide Post
Foccrawler,

I think we are in a "Can't see the forest ..." type situation.

The way you are trying to do this is not correct. However, before you waste any more time on this, I think you should open a problem with NY and ask the question: Can you load a dynamic drop down through the HTML layout tool using cgi only?

I just tried a test, and I was unsuccessful at loading a drop down box using cgi. When I used servlet, it worked without a problem.

Once NY answers that question, then this forum will be able to tell you exactly how to accomplish what you are trying to do.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Member
posted Hide Post
Thanks for the guidance. I will do just that.
Bill
 
Posts: 22 | Location: Waterbury VT USA | Registered: November 15, 2005Report This Post
Expert
posted Hide Post
Bill,

Place the following code into a fex called something (e.g. selpay.fex) and then when you are in resource layout painter (GUI) select your combo box and set the data source to be a procedure called something (i.e. selpay.fex).

When you load your HTML page the fex will be run via an adhoc fex (within ibirls.js) and the XML will be parsed via activeX into the combo box (all internal to ibirls.js).

quote:
FILEDEF PAYFEED1 DISK C:\IBI\APPS\BASEAPP\PAYROLL_DATA\PAYFEED1.FTM
TABLE FILE PAYFEED1
SUM PAYPERIOD
BY PAYPERIOD
ON TABLE PCHOLD FORMAT XML
END


Providing that your MFD is accessable via the APP PATH (use APP SHOWPATH to check) all should be hunky dory.

If I get a chance, I will post an example. Can't promise but will try.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
Hi Bill,

Create a new procedure, call it selctry.fex and place the following code within it -
-* File selctry.fex
TABLE FILE CAR
SUM FST.COUNTRY
BY COUNTRY
ON TABLE PCHOLD FORMAT XML
END
Next create a new procedure, call it car_rep.fex and place the following code within it -
-* File car_rep.fex
-DEFAULT &Country = 'FOC_NONE'
SET PAGE-NUM = NOPAGE
TABLE FILE CAR
SUM RCOST
    DCOST
 BY COUNTRY
 BY CAR
 BY MODEL
 WHERE COUNTRY EQ '&Country'
 HEADING
 "</2"
 ON TABLE SET ONLINE-FMT HTML
 ON TABLE SET HTMLCSS ON
END
Now open the car_rep.fex with resource layout painter and you should see a semi built web page with a combo box with Country shown within it together with submit and reset buttons.
Select the combo box with a single left mouse click and the "Parameters" panel should show the current, default, settings for this combo box. You will see that the Control values are set for dynamic and that the value and display fields are set to COUNTRY from car.mas as the data source.
Change the radio button showing data source to Procedure, click on the button with the three dots and locate and select the procedure called selctry.fex (created above). Finally check the 'Add "ALL" option' then Save and close the resource layout painter.

Now run the car_rep.fex and you will see the combo box has been populated with the output from the fex.

Hope this helps

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
Incidently, the car_rep.fex works equally as well when run with servlet, cgi or ISAPI. As it should do. After all, this is only executing a fex against a reporting server, holding the output on the client PC in an XML format, and then, using an MS ActiveX object, dynamically populating a combo box with the XML output.

Your next question is going to be -

"That's great but how do I chain two or more combo boxes using fexes to populate them."

And my answer will be -

When the chaining of combo boxes is applied to a WebFOCUS resource layout painter built web page, the JavaScript internals assign an onchange event to each of the chained combo boxes in turn. The function called by this event builds an execution string (URL type) that includes the value(s) from each preceding combo box.

So, for instance, if we add a new combo box to my previous example to allow selection of Car and we chain it to the combo box for Country, when the fex to populate the Car combo box is executed, it will be executed with the variable &Country and it's value in the URL. i.e. If we change the selection to ENGLAND, the execution of the second fex for the Car combo box will include &Country=ENGLAND.

To extend the previous example, create a new fex called selcar.fex and insert the following code -
-* File selcar.fex
-DEFAULT &Country = 'FOC_NONE'
TABLE FILE CAR
SUM FST.CAR
BY CAR
WHERE COUNTRY EQ '&Country'
ON TABLE PCHOLD FORMAT XML
END
Now add a default value for &Car to the car_rep.fex and a selection clause for CAR being equal to &Car -
  AND CAR EQ '&Car'
Next reopen the car_rep.fex using resource layout painter and you should see a new combo box for the variable &Car. Select this and assign the parameter settings to Procedure, selcar.fex and the ALL option as before.
Check that the combo box for Country is still correct.
Next select Country and then Car combo boxes and click the "chain controls" icon on the lower bar (the one with the yellow plus sign). Each combo box should now have a small icon on the top left corner indicating the order in which they are "chained".
Save your work and execute the car_rep.fex to see the interaction between the combo boxes.

Of course, each successive chained combo box would require a DEFAULT value for all preceding fexes plus a selection clause as per selcar.fex.

Try adding one for MODEL.

Now look forward to a fulfilling time of using fexes to populate your combo boxes and even chaining them!!

Enjoy

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
Hmmmmm....

Just looked at doing this using vsn 7.1.1 Dev Studio and the "new" HTML Painter and my first reaction is that I am not a fan of the HTML that is produced. It is even more overly complex than the vsn 5.3.2. It functions fine, but I need to delve into it more so that I can understand what it is doing. For now I will probably stick with the good old text editor and code by hand. My biggest bug-bear is that the code is totally dis-organised. Accuse me of OCD if you want, but when I leave my Client's site I want to leave concise, documented, well formed and supportable code.

To get the second combo box working I had to delete the original HTML file and start again. Not great if you have spent a long time creating a magical launch page only to have to start all over again. It may be the way I was trying to do things but I couldn't get it to forget about the original imported fex and take up on the new version. OK I know the intention is that all things can be achieved from the GUI "out of the box" but I think that this new version is going to cause some headaches come modification time.

I'm sure that is not what IB want to hear and I'm also sure that my opinion will change over time but, initial reaction is that it will cause me a lot of work progressing modifications to existing code from 5.3.2. and this fact will flavour my recommendations to my Client's regarding upgrading.



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
Tony,

I"m just learning, but I found that when using the tool, don't embed the fex execute external file. Otherwise, I found we always had to change the fex from within the gui, Ugh


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Member
posted Hide Post
Tony,
Thanks for the assignment you gave me. I'll be sure to work on it! Appreciate the time and effort put into this.

First it does appear that I have had success for sure on your posting of 4:58 PM yesterday. That's the one directly related to the problem I was having. It put me into kind of a party mode this morning. The kind of things that make us celebrate. Thanks again.

The 3 cardinal missing points I learned through this dialogue were:
(1) Dhagen's note above (02/27/06 4:50 PM) "Procedure should always have 2 columns", etc.
(2) Both your and Dhagen's insistence that ON TABLE FORMAT XML is the way to go.
(3) That the XML resulting procedure producing the drop-down values is to be pointed to as a procedure (radio button) by the Parameter Properties window in RLP.

I did attempt your exercise posted at 3:35 this AM. Basically successful but with these following points:
(1) Unless I originate the CAR_REP fex procedure by establishing it as a new document (in Dev Studio) with the Resource Layout Painter (RLP), then "Edit in Auto-detected tool" insists that the tool is Report Painter. So I first establish with RLP, immediately close, and use text editor to construct the code.
(2) After completing this procedure and running CAR_REP.FEX what I received was the html results of CAR_REP, and, superimposed on top of it was the drop-down box produced by SELCTRY.

Now with my yet rudimentary knowledge of how this all works, my assumption is that I would now want to remove the report-producing code from CAR_REP and place it in an entirely different procedure to be called by the SUBMIT button. As it is now the submit button just calls on its self (the fex having the same name as the htmlform). I'm thinking out loud. Does all this make sense? Because the real report I want to run may be quite complex with a lot of its own code, etc. Somewhere in there though I will want to have that line WHERE COUNTRY EQ '&COUNTRY'" Therefore I think that I want "SUBMIT" to point elsewhere.

At any rate that's what I'll be fooling with next to see if it works.

Dhagen..
I did hear from NY and Tech Support. They basically said that this can be done with CGI and they pointed me in pretty much the same direction as Tony has. Their reference was to the 5.3 Developing Applications pdf manual page 198 (hard copy page 6-64). They also recommended upgrade.....however:
I just read Tony's submission this afternoon. That walong with other things I've seen here on Focal Point makes me very nervous. I'm in no hurry.

Thanks to all. I continue to appreciate all the thoughts and help. This is a continual learning process.
Bill
 
Posts: 22 | Location: Waterbury VT USA | Registered: November 15, 2005Report This Post
Member
posted Hide Post
Tony A: I'm a rookie and also struggling with populating a drop down list with an .fex in version 7. Would you provide the html snippet that references the 2 .fex files in your car_rep to selctry scenario? If it matters, I'm using DB2 SQL and stored procedures for data retrieval. Thanks.
 
Posts: 9 | Location: Boston | Registered: November 10, 2005Report This Post
Expert
posted Hide Post
Of course.

The following code was hand coded in 5.3.2 on Windows. As you are probably aware, I'm not a fan of the GUI although the HTML originates from the report layout painter. This is because it provides the basics that I needed to refine the HTML and also speeds the end result. I could go into why I take this approach but you might have heard the phrase - "Old coders never die, they just ..........".

Given that this is provided code and the problem Bill had in placing it into the required file, just right click in your application and choose "New" and then "Procedure" or "HTML File" as required. Before clicking OK on the next dialogue, choose "Text Editor" from the "Create with" selection box.

The HMTL file. Place it in the baseapp application folder to ensure that you require no changes to the code -

<HTML>
<HEAD>
<TITLE>HtmlPage
</TITLE>
<META content="WebFocus Report Layout Painter" name ="Generator">
<script id=IbiOptionsScript type=text/javascript>
var cgipath = "cgipath";
var ibirls = "ibirls";
var multidrill = "multidrill";
var mntFormValidate = "mntFormValidate";
var dyncalendar = "dyncalendar";
var ibiOptions = new Array(cgipath,ibirls,mntFormValidate,multidrill);
</SCRIPT>
<script id=nls src="/ibi_html/javaassist/nls.js" type=text/javascript>
</SCRIPT>
<script id=ibigbl src="/ibi_html/javaassist/ibi/html/js/ibigbl.js" type=text/javascript>
</SCRIPT>
<script id=ibigblloadCss type=text/javascript>
ibigblloadCss(null);
</SCRIPT>
</HEAD>
<BODY onload=OnLoad[) nextelementnum="6" drawgrid="1" snaptogrid="1" gridsizeCX="5" gridsizeCY="5"
pagesizeCX="2000" pagesizeCY="2000">
< !--startibiitems-->
<FORM onsubmit=SaveValues[) method=post name ="form">
<INPUT type=hidden value=car_rep name ="IBIF_ex">
<INPUT id=IBIAPP_app type=hidden value=baseapp name ="IBIAPP_app">
<SELECT id=ITEM1 style="Z-INDEX: 4; LEFT: 20px; WIDTH: 150px; POSITION: absolute; TOP: 25px; HEIGHT: 22px"
name ="Country" elementname="combobox1" elementtype="combobox" labelid caption="combobox" operation="NONE"
ibiformat datatype="1" addalloption="1" dynalldisplayvalue="ALL" inchainindex="1" chainnumber="0"
cacheruntimedata="0" displayfield="COUNTRY" numofrecords="-1" datafield="COUNTRY" sourcetype="typeFex"
datasource="selctry1.fex" IBIC_server IBIAPP_app="baseapp" datafieldtype="CHAR">
</SELECT>
<INPUT id=ITEM2 style="Z-INDEX: 5; LEFT: 20px; WIDTH: 80px; POSITION: absolute; TOP: 60px; HEIGHT: 30px"
type=submit value=Submit name ="button2" elementname="button2" elementtype="button" sourcetype="typeUrl"
targetname targettype="0" onclickset="0">
<INPUT id=ITEM3 style="Z-INDEX: 6; LEFT: 110px; WIDTH: 80px; POSITION: absolute; TOP: 60px; HEIGHT: 30px"
type=reset value=Reset name ="button3" elementname="button3" elementtype="button" sourcetype="typeUrl"
targetname targettype="0" onclickset="0">
<SELECT id=ITEM4 style="Z-INDEX: 11; LEFT: 185px; WIDTH: 150px; POSITION: absolute; TOP: 25px; HEIGHT: 22px"
name ="Car" elementname="combobox4" elementtype="combobox" labelid caption="combobox" operation="NONE"
ibiformat datatype="1" addalloption="1" dynalldisplayvalue="ALL" inchainindex="2" chainnumber="0"
cacheruntimedata="0" displayfield="COUNTRY" numofrecords="-1" datafield="COUNTRY" sourcetype="typeFex"
datasource="selctry2.fex" IBIC_server IBIAPP_app="baseapp" datafieldtype="CHAR">
</SELECT>
<SELECT id=ITEM5 style="Z-INDEX: 12; LEFT: 350px; WIDTH: 150px; POSITION: absolute; TOP: 25px; HEIGHT: 22px"
name ="Model" elementname="combobox5" elementtype="combobox" labelid caption="combobox" operation="NONE"
ibiformat datatype="1" addalloption="1" dynalldisplayvalue="ALL" inchainindex="3" chainnumber="0"
cacheruntimedata="0" displayfield="COUNTRY" numofrecords="-1" datafield="COUNTRY" sourcetype="typeFex"
datasource="selctry3.fex" IBIC_server IBIAPP_app="baseapp" datafieldtype="CHAR">
</SELECT>
</FORM>
<script type=text/javascript>
< !--
window.chain0=new Array(1);
window.chain0[0]=new String("ITEM1;ITEM4;ITEM5");
window.chain0[1]=0
//-->
</SCRIPT>
< !--endibiitems-->
<script id=OnloadHandler>
function OnLoad() {
< !--startibilines-->
UpdateData();
< !--endibilines-->
}
</SCRIPT>
</BODY>
</HTML>


The fexes used to populate the selects. Place all three in the baseapp application folder, as per your HTML above. Fex names are in the comment lines -

-* File selctry1.fex
TABLE FILE CAR
SUM FST.COUNTRY
BY COUNTRY
ON TABLE PCHOLD FORMAT XML
END

-* File selctry2.fex
-DEFAULT &Country = 'FOC_NONE'
TABLE FILE CAR
SUM FST.CAR
BY CAR
WHERE COUNTRY EQ '&Country'
ON TABLE PCHOLD FORMAT XML
END

-* File selctry3.fex
-DEFAULT &Country = 'FOC_NONE'
-DEFAULT &Car     = 'FOC_NONE'
TABLE FILE CAR
SUM FST.MODEL
BY MODEL
WHERE COUNTRY EQ '&Country'
  AND CAR     EQ '&Car'
ON TABLE PCHOLD FORMAT XML
END


The ultimate report would need to have a default for each variable that will be pumped in from the web page (good practice) and also a WHERE clause.

-* File car_rep.fex
-DEFAULT &Country = 'FOC_NONE'
-DEFAULT &Car     = 'FOC_NONE'
-DEFAULT &Model   = 'FOC_NONE'
SET PAGE-NUM = NOPAGE
TABLE FILE CAR
SUM RCOST
    DCOST
 BY COUNTRY
 BY CAR
 BY MODEL
 WHERE COUNTRY EQ '&Country'
   AND CAR     EQ '&Car'
   AND MODEL   EQ '&Model'
 ON TABLE SET ONLINE-FMT HTML
 ON TABLE SET HTMLCSS ON
END


Whilst this uses the IB CAR file and just FOCUS reports the code will be the same format if you are using synonyms against your DB2 tables (or any other RDBMS). It is also simple to adjust for SQL passthru and with MS SQL I use this method all the time -

For instance, if you have the MS Access data adapter setup and you have access to NorthWind.mdb via WebFOCUS then you could code the following to populate your select box -

-* Don't forget to set up your connection strings etc.
SQL
  SELECT DISTINCT EmployeeID
       , FirstName + " " + LastName AS FullName
    FROM NorthWind
;
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD
END
-RUN
TABLE FILE HOLD
PRINT FullName
   BY EmployeeID
   ON TABLE PCHOLD FORMAT XML
END
-RUN


Sorry this post is a bit long but it gives you a complete scenarion that should work "out of the box"

Edited because of the tismypes and we still don't have a speelchuker

Edited again because Mabel has been changing things (again) and mucking up the post. Thanks Mabel

This message has been edited. Last edited by: Tony A,



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
Leah,

My sincere apologies for not responding to your post a while back - very remis of me, sorry.

Anyway, thanks for that snippet it is certainly worth remembering and should (and could) save hours of frustration!!

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Hi Tony,

I have tried you CAR example for chaining using XML. i placed all 3 apps in baseapp and when i run the html, the dropdowns dont populate. can you please help. here is my code:
  
<HTML>
<HEAD>
<TITLE>HtmlPage
</TITLE>
<META content="WebFocus Report Layout Painter" name ="Generator">
<script id=IbiOptionsScript type=text/javascript>
var cgipath = "cgipath";
var ibirls = "ibirls";
var multidrill = "multidrill";
var mntFormValidate = "mntFormValidate";
var dyncalendar = "dyncalendar";
var ibiOptions = new Array(cgipath,ibirls,mntFormValidate,multidrill);
</SCRIPT>
<script id=nls src="/ibi_html/javaassist/nls.js" type=text/javascript>
</SCRIPT>
<script id=ibigbl src="/ibi_html/javaassist/ibi/html/js/ibigbl.js" type=text/javascript>
</SCRIPT>
<script id=ibigblloadCss type=text/javascript>
ibigblloadCss(null);
</SCRIPT>
</HEAD>
<BODY style="FONT-WEIGHT: 700; FONT-SIZE: 10pt; OVERFLOW: auto; FONT-STYLE: normal; FONT-FAMILY: System; BACKGROUND-COLOR: rgb[147,181,206); TEXT-DECORATION: none" bgColor=#000000>
< !--startibiitems-->
<FORM id=form2 style="Z-INDEX: 2; LEFT: 0px; WIDTH: 790px; POSITION: absolute; TOP: 60px; HEIGHT: 630px" tabIndex=2 name=form2 onsubmit="OnExecute[this);win_open[);return false;" method=get form_dist_between_desc_and_input="10" form_hor_dist_between_controls="10" vert_dist_between_controls="10" form_number_of_columns="4" form_number_of_visible_rows="4" form_prompt_location="1" fexlist_list="report1;form2" requests_list="6" operation="OR" multiple="multiple">
<INPUT id=ITEM2 style="Z-INDEX: 5; LEFT: 20px; WIDTH: 80px; POSITION: absolute; TOP: 160px; HEIGHT: 30px" type=submit value=Submit name ="button2" elementname="button2" elementtype="button" sourcetype="typeUrl" targetname targettype="0" onclickset="0">
<INPUT id=ITEM3 style="Z-INDEX: 6; LEFT: 110px; WIDTH: 80px; POSITION: absolute; TOP: 160px; HEIGHT: 30px" type=reset value=Reset name ="button3" elementname="button3" elementtype="button" sourcetype="typeUrl" targetname targettype="0" onclickset="0">

<SELECT id=ITEM1 style="Z-INDEX: 4; LEFT: 20px; WIDTH: 150px; POSITION: absolute; TOP: 5px; HEIGHT: 140px" size=5 name="Country" elementname="combobox1" elementtype="combobox" labelid caption="combobox" operation="NONE" ibiformat datatype="1" addalloption="1" dynalldisplayvalue="ALL" inchainindex="1" chainnumber="0" cacheruntimedata="0" displayfield="COUNTRY" numofrecords="-1" datafield="COUNTRY" sourcetype="typeFex" datasource="rvts668a.fex" IBIC_server IBIAPP_app="baseapp" datafieldtype="CHAR">
</SELECT>
<SELECT id=ITEM4 style="Z-INDEX: 11; LEFT: 185px; WIDTH: 150px; POSITION: absolute; TOP: 5px; HEIGHT: 140px" size=5 name="Car" elementname="combobox4" elementtype="combobox" labelid caption="combobox" operation="NONE" ibiformat datatype="1" addalloption="1" dynalldisplayvalue="ALL" inchainindex="2" chainnumber="0" cacheruntimedata="0" displayfield="CAR" numofrecords="-1" datafield="CAR" sourcetype="typeFex" datasource="rvts668b.fex" IBIC_server IBIAPP_app="baseapp" datafieldtype="CHAR">
</SELECT>
<SELECT id=ITEM5 style="Z-INDEX: 12; LEFT: 350px; WIDTH: 150px; POSITION: absolute; TOP: 5px; HEIGHT: 140px" size=5 name="Model" elementname="combobox5" elementtype="combobox" labelid caption="combobox" operation="NONE" ibiformat datatype="1" addalloption="1" dynalldisplayvalue="ALL" inchainindex="3" chainnumber="0" cacheruntimedata="0" displayfield="MODEL" numofrecords="-1" datafield="MODEL" sourcetype="typeFex" datasource="rvts668c.fex" IBIC_server IBIAPP_app="baseapp" datafieldtype="CHAR">
</SELECT>

<INPUT id=IBIMR_domain style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=developm/developm.htm name=IBIMR_domain>
<INPUT id=IBIMR_folder style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=#testinghlvo3 name=IBIMR_folder>
<INPUT id=ibif_ex style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=app/rvts668z.htm name=ibif_ex>
<INPUT id=ibiapp_app style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=baseapp name=ibiapp_app ismre="1">
<INPUT id=ibic_server style="LEFT: -100px; POSITION: absolute; TOP: -100px" type=hidden value=SHARED name=ibic_server>
<input type='hidden' name='IBIMR_action' value="MR_RUN_FEX">
<input type='hidden' name='IBIMR_sub_action' value="MR_STD_REPORT">
<input type='hidden' name='IBIMR_fex' value="app/rvts668r.fex">
< !-- THIS IS THE SAME AS THE LINE ABOVE IT... -->
<input type='hidden' name='IBIF_ex' value="app/rvts668r.fex">
<input type='hidden' name='IBIMR_flags' value="">
</FORM>
<script type=text/javascript>
< !--
window.chain0=new Array(1);
window.chain0[0]=new String("ITEM1;ITEM4;ITEM5");
window.chain0[1]=0
//-->
</SCRIPT>
< !--endibiitems-->
<script id=OnloadHandler>
function OnLoad() {
< !--startibilines-->
UpdateData();
< !--endibilines-->
}
</SCRIPT>
</BODY>
</HTML>



the following 3 files in baseapp procedures folder:
-* File rvts668a.fex
-*APP HOLD BASEAPP
-*
TABLE FILE CAR
SUM FST.COUNTRY
BY COUNTRY
ON TABLE PCHOLD FORMAT XML
END


-* File rvts668b.fex
-*APP HOLD BASEAPP
-*
-DEFAULT &Country = 'FOC_NONE'
TABLE FILE CAR
SUM FST.CAR
BY CAR
WHERE COUNTRY EQ '&Country'
ON TABLE PCHOLD FORMAT XML
END


-* File rvts668c.fex
-*APP HOLD BASEAPP
-*
-DEFAULT &Country = 'FOC_NONE'
-DEFAULT &Car     = 'FOC_NONE'
TABLE FILE CAR
SUM FST.MODEL
BY MODEL
WHERE COUNTRY EQ '&Country'
  AND CAR     EQ '&Car'
ON TABLE PCHOLD FORMAT XML
END



quote:
Originally posted by Tony A:
Of course.

The following code was hand coded in 5.3.2 on Windows. As you are probably aware, I'm not a fan of the GUI although the HTML originates from the report layout painter. This is because it provides the basics that I needed to refine the HTML and also speeds the end result. I could go into why I take this approach but you might have heard the phrase - "Old coders never die, they just ..........".

Given that this is provided code and the problem Bill had in placing it into the required file, just right click in your application and choose "New" and then "Procedure" or "HTML File" as required. Before clicking OK on the next dialogue, choose "Text Editor" from the "Create with" selection box.

The HMTL file. Place it in the baseapp application folder to ensure that you require no changes to the code -

<HTML>
<HEAD>
<TITLE>HtmlPage
</TITLE>
<META content="WebFocus Report Layout Painter" name ="Generator">
<script id=IbiOptionsScript type=text/javascript>
var cgipath = "cgipath";
var ibirls = "ibirls";
var multidrill = "multidrill";
var mntFormValidate = "mntFormValidate";
var dyncalendar = "dyncalendar";
var ibiOptions = new Array(cgipath,ibirls,mntFormValidate,multidrill);
</SCRIPT>
<script id=nls src="/ibi_html/javaassist/nls.js" type=text/javascript>
</SCRIPT>
<script id=ibigbl src="/ibi_html/javaassist/ibi/html/js/ibigbl.js" type=text/javascript>
</SCRIPT>
<script id=ibigblloadCss type=text/javascript>
ibigblloadCss(null);
</SCRIPT>
</HEAD>
<BODY onload=OnLoad[) nextelementnum="6" drawgrid="1" snaptogrid="1" gridsizeCX="5" gridsizeCY="5"
pagesizeCX="2000" pagesizeCY="2000">
< !--startibiitems-->
<FORM onsubmit=SaveValues[) method=post name ="form">
<INPUT type=hidden value=car_rep name ="IBIF_ex">
<INPUT id=IBIAPP_app type=hidden value=baseapp name ="IBIAPP_app">
<SELECT id=ITEM1 style="Z-INDEX: 4; LEFT: 20px; WIDTH: 150px; POSITION: absolute; TOP: 25px; HEIGHT: 22px"
name ="Country" elementname="combobox1" elementtype="combobox" labelid caption="combobox" operation="NONE"
ibiformat datatype="1" addalloption="1" dynalldisplayvalue="ALL" inchainindex="1" chainnumber="0"
cacheruntimedata="0" displayfield="COUNTRY" numofrecords="-1" datafield="COUNTRY" sourcetype="typeFex"
datasource="selctry1.fex" IBIC_server IBIAPP_app="baseapp" datafieldtype="CHAR">
</SELECT>
<INPUT id=ITEM2 style="Z-INDEX: 5; LEFT: 20px; WIDTH: 80px; POSITION: absolute; TOP: 60px; HEIGHT: 30px"
type=submit value=Submit name ="button2" elementname="button2" elementtype="button" sourcetype="typeUrl"
targetname targettype="0" onclickset="0">
<INPUT id=ITEM3 style="Z-INDEX: 6; LEFT: 110px; WIDTH: 80px; POSITION: absolute; TOP: 60px; HEIGHT: 30px"
type=reset value=Reset name ="button3" elementname="button3" elementtype="button" sourcetype="typeUrl"
targetname targettype="0" onclickset="0">
<SELECT id=ITEM4 style="Z-INDEX: 11; LEFT: 185px; WIDTH: 150px; POSITION: absolute; TOP: 25px; HEIGHT: 22px"
name ="Car" elementname="combobox4" elementtype="combobox" labelid caption="combobox" operation="NONE"
ibiformat datatype="1" addalloption="1" dynalldisplayvalue="ALL" inchainindex="2" chainnumber="0"
cacheruntimedata="0" displayfield="COUNTRY" numofrecords="-1" datafield="COUNTRY" sourcetype="typeFex"
datasource="selctry2.fex" IBIC_server IBIAPP_app="baseapp" datafieldtype="CHAR">
</SELECT>
<SELECT id=ITEM5 style="Z-INDEX: 12; LEFT: 350px; WIDTH: 150px; POSITION: absolute; TOP: 25px; HEIGHT: 22px"
name ="Model" elementname="combobox5" elementtype="combobox" labelid caption="combobox" operation="NONE"
ibiformat datatype="1" addalloption="1" dynalldisplayvalue="ALL" inchainindex="3" chainnumber="0"
cacheruntimedata="0" displayfield="COUNTRY" numofrecords="-1" datafield="COUNTRY" sourcetype="typeFex"
datasource="selctry3.fex" IBIC_server IBIAPP_app="baseapp" datafieldtype="CHAR">
</SELECT>
</FORM>
<script type=text/javascript>
< !--
window.chain0=new Array(1);
window.chain0[0]=new String("ITEM1;ITEM4;ITEM5");
window.chain0[1]=0
//-->
</SCRIPT>
< !--endibiitems-->
<script id=OnloadHandler>
function OnLoad() {
< !--startibilines-->
UpdateData();
< !--endibilines-->
}
</SCRIPT>
</BODY>
</HTML>


The fexes used to populate the selects. Place all three in the baseapp application folder, as per your HTML above. Fex names are in the comment lines -

-* File selctry1.fex
TABLE FILE CAR
SUM FST.COUNTRY
BY COUNTRY
ON TABLE PCHOLD FORMAT XML
END

-* File selctry2.fex
-DEFAULT &Country = 'FOC_NONE'
TABLE FILE CAR
SUM FST.CAR
BY CAR
WHERE COUNTRY EQ '&Country'
ON TABLE PCHOLD FORMAT XML
END

-* File selctry3.fex
-DEFAULT &Country = 'FOC_NONE'
-DEFAULT &Car     = 'FOC_NONE'
TABLE FILE CAR
SUM FST.MODEL
BY MODEL
WHERE COUNTRY EQ '&Country'
  AND CAR     EQ '&Car'
ON TABLE PCHOLD FORMAT XML
END


The ultimate report would need to have a default for each variable that will be pumped in from the web page (good practice) and also a WHERE clause.

-* File car_rep.fex
-DEFAULT &Country = 'FOC_NONE'
-DEFAULT &Car     = 'FOC_NONE'
-DEFAULT &Model   = 'FOC_NONE'
SET PAGE-NUM = NOPAGE
TABLE FILE CAR
SUM RCOST
    DCOST
 BY COUNTRY
 BY CAR
 BY MODEL
 WHERE COUNTRY EQ '&Country'
   AND CAR     EQ '&Car'
   AND MODEL   EQ '&Model'
 ON TABLE SET ONLINE-FMT HTML
 ON TABLE SET HTMLCSS ON
END


Whilst this uses the IB CAR file and just FOCUS reports the code will be the same format if you are using synonyms against your DB2 tables (or any other RDBMS). It is also simple to adjust for SQL passthru and with MS SQL I use this method all the time -

For instance, if you have the MS Access data adapter setup and you have access to NorthWind.mdb via WebFOCUS then you could code the following to populate your select box -

-* Don't forget to set up your connection strings etc.
SQL
  SELECT DISTINCT EmployeeID
       , FirstName + " " + LastName AS FullName
    FROM NorthWind
;
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD
END
-RUN
TABLE FILE HOLD
PRINT FullName
   BY EmployeeID
   ON TABLE PCHOLD FORMAT XML
END
-RUN


Sorry this post is a bit long but it gives you a complete scenarion that should work "out of the box"

Edited because of the tismypes and we still don't have a speelchuker

Edited again because Mabel has been changing things (again) and mucking up the post. Thanks Mabel

This message has been edited. Last edited by: Kerry,
 
Posts: 2 | Registered: November 07, 2007Report This Post
Expert
posted Hide Post
Firstly please complete the signature in your profile as you are invited to do in this link which is given at the top of the forum.

Secondly, as you will see from the post containing the sample code, there had been some edits actioned by a previous administrator. This had the effect of rendering a lot of the code buggy to say the least.

So I would suggest that you look through the HTML that you have copied (and changed e.g. fex references) and identify the coding errors within it - I have spotted at least 7.

The fexes are OK providing that you can run them manually and receive XML output with the correct contents.

I would also add that if you want to get away from the GUI and manually write code (and copy / paste plus edit) then you have a certain responsibility to yourself regarding learning the syntax of that "language" (WebFOCUS, HTML, Javascript etc.). This is why I am telling you that there are at least 7 coding errors in the HTML so that you can prove to yourself that your understanding is sufficient to progress.

I have run the code in DS 7.6.9 and it works once the errors are corrected.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Create DD list from procedure using GUI

Copyright © 1996-2020 Information Builders