Focal Point
Pass a single parameter from drop down box to more than one fex in HTML layout

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

June 19, 2008, 12:47 PM
MIN27
Pass a single parameter from drop down box to more than one fex in HTML layout
Hi all,

First would like to say that I have found this forum to be invaluable from my starting to use Webfocus just over three months ago. Thank you.

I now have a major issue that I need assistance with. Please can you help..

I have built up a number of fex's that I want to display as HTML using HTML layout painter. I have managed to do this.

I now want to be able to produce a drop down list over these graphs, so that when I select a value from the drop down the graphs all refresh for the chosen parameter. My difficulty lies in the fact that i want to pass one paramter value to the different graphs.

I hope this makes sense, any help would be greatly appreciated.

Regards


Webfocus version 7.6.4
London, England
June 19, 2008, 12:59 PM
BlueZone
MIN27 -
With the power of FOCUS/WF, you can find a lot of solutions to every challenge.

Try if this works for you -

#1) Have a master program that will accept the input variables and execute all
the various sub-programs with a -INCLUDE.

#2) Hold the output of each sub-program to a Hold file (can be a report or graph).

#3) At the end of the master program, code a block of HTML to plug in all the hold files into the HTML page with the bang command

example -

 
<HTML>
..... (standard body)
!IBI.FIL.HOLD1;
!IBI.FIL.HOLD2;
!IBI.FIL.HOLD3;
.... .     
.....  (repeat Bang for the number of hold reports you have)
.....
</HTML>
 


Best regards,
Sandeep Mamidenna


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music
June 19, 2008, 01:07 PM
MIN27
Thanks for the quick response Sandeep,

I am new to coding HTML, so I am unsure as to how easy your response is. I was kind of hoping there was a simpler way, that I could get away with using the GUI.

Any slightly simpler thoughts?

Cheers

MIN SANDHU


Webfocus version 7.6.4
London, England
June 20, 2008, 09:52 AM
BJones
MIN27,

There was just a Lab at Summit called 'Use Drill Down to JavaScript to Display Multiple Reports/Graphs' that showed how to do this using the GUI tools. The presentation is not currently on the web site. Maybe you can send an email to Larry Braun of IBI to see if he can send you the presentation, he was the one that taught the Lab. I assume his email is larry_braun@ibi.com.

Bob




Prod: WebFocus/ReportCaster 7.6.10 - Self Service - Windows 2003 Server - IIS/Tomcat

Test: WebFocus/ReportCaster 7.6.10 - Self Service - Windows 2003 Server - IIS/Tomcat

Databases: MS SQL Server, Focus DB, Output: HTML, Excel 2000 and PDF
June 20, 2008, 09:55 AM
cburtt
MIN27,

Can you hold the parameter in an &&variable? Variables named with double-amber are held throughout the entire WF session and are avaialble to all the *.fex and TABLE FILE ... END blocks the agent-session encounters.

However, if the *.fex ends with -HTMLFORM, the
session terminates and a new one starts when pressing the the form's 'Submit'. Hold the &&vars through this interval as hidden html fields in the form. They will be available to the form's Actions and be passed in that way into whatever *.fex the form launches.

Chris


WIN/2K running WF 7.6.4
Development via DevStudio 7.6.4, MRE, TextEditor.
Data is Oracle, MS-SQL.
June 20, 2008, 12:00 PM
AG
One of the drill-down options available in WebFOCUS is the ability to invoke a javascript procedure. The Report Painter GUI allows the developer to a select a target frame or window for the "drill to" report. By using a javascript function you can drill down to multiple reports in different frames. The resultant reports can be displayed in different frames on a single page using the HTML layout painter.

The technique can be summed up as follows:

1) Create a procedure(fex), include the reference to the javascript file via a SET command.

SET JSURL=/approot/baseapp/RunReports.js
...
TABLE FILE XYZ
..

2) Create the appropriate javascript function. Example Filename: RunReports.js
function RunReports (param1, param2)
{
drillStr='&' + 'REGION=' + param1+ '&' + 'PROD_TYPE=' + param2;
rpt3 = '/ibi_apps/WFServlet?IBIF_ex=report1' + drillStr;
rpt2 = '/ibi_apps/WFServlet?IBIF_ex=report2' + drillStr;
rpt4 = '/ibi_apps/WFServlet?IBIF_ex=report3' + drillStr;
rpt1 = '/ibi_apps/WFServlet?IBIF_ex=report4' + drillStr;


window.open(rpt1,'iframe1');
window.open(rpt2,'iframe2');
window.open(rpt3,'iframe3');
window.open(rpt4,'iframe4');
}

3)Modify the stylesheet of the procedure to include the javascript drill down option
...
$ TYPE=DATA,
COLUMN=N1,
JAVASCRIPT=RunReports(param1 param2),
$
...
June 22, 2008, 10:19 PM
StuBouyer
Min27,

I'm assuming that you are creating a html page that has a number of graphs on it in individual frames. If that is so then you can add a dropdown box and assign it to a variable/parameter from the graphs using the "Parameters" tab on the properties viewer. If all your graphs use the same name for the parameter then they will all get the same value.

One easy way to do this with Dev Studio is to create the graph (or report) with a parameter and then add that graph to the HTML layout painter. Dev studio will notice the parameter is required and ask if you want to automatically add a control to the page. Make sure you use drop down list instead of text box and you should be fine.

If you want all graphs to execute when the "go" button is clicked, have a look at the HTML code there should be a requests_list="0" (your number will vary) associated with the
<FORM >
tag that Dev Studio has created. You simply need to add the other request IDs that you want to have executed to this list.

At the bottom your code you will see a section with XML code that holds info on the reports to be executed, there will be a entry fro each report/graph on the page that looks like:

request requestid="1" targetname="report2" ibif_ex="report2"


Add all the numbers to the requests_list value seperated by semi-colons. So to run reports 0 and 1 you would have requests_list="0;1".

There may be a way to assign this via the GUI, but I've never bothered to look to be honest.

Hope this helps

Stu


WebFOCUS 8.2.03 (8.2.06 in testing)
June 22, 2008, 11:26 PM
susannah
I agree w/ Stu and Blue,
html is very really very easy and people seem to go to great lengths to avoid using it.
bite the bullet, pick up an 'html for dummies' book, spend a saturday and you'll be so glad you did.
Blue's suggestion would be my first choice..its easy as pie. look..
TABLE FILE CAR
IF COUNTRY EQ &MYCOUNTRY
ON TABLE HOLD AS HOLD1 FORMAT HTMTABLE
END
GRAPH FILE CAR
IF COUNTRY EQ &MYCOUNTRY
ON TABLE HOLD AS JOLD2 FORMAT HTMTABLE
END
TABLE FILE somethingelse
IF COUNTRY EQ &MYCOUNTRY
..
ON TABLE HOLD AS MYTHING FORMAT HTMTABLE
END
-RUN
-* this is just what Blue says above
-HTMLFORM BEGIN
!IBI.FILE.HOLD1;
!IBI.FILE.HOLD2;
!IBI.FILE.HOLD3;
-HTMLFORM END

.*.now kick it up a notch and try the layout with all the tables next to each other.
-HTLMFORM BEGIN
<HTML>
<TABLE>
<tr><td>
!IBI.FIL.HOLD1;
</TD>
<td>!IBI.FIL.HOLD2;
</TD>
<TD>
!IBI.FIL.HOLD3;
</TD>
</TR><TABLE>
</HTML>
-HTMLFORM END





In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
June 22, 2008, 11:54 PM
Waz
Even if you don't want to get a book on HTML, there are many examples, have a look in Cent Corp Demo or IBISAMP


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 23, 2008, 03:05 AM
Tony A
Whilst endorsing all that has been said above, I am not sure that any have answered your actual question. So let's see if this will help on specifics.

You say that you have managed to add your reports using the GUI but that you want to now add a control that will pass a value to each of the reports.

Ok, so the first question is how did you add your reports? If you added them by importing an existing report then you might need to start again - lets give you the whole process -

Begin a new HTML document using the painter and add four frames using - insert / frame - or clicking the frame icon (basically white with a blue top bar) and dragging out the frame size(s) that you want. You'll notice in the properties dialog that each new frame is given a unique identifier - iframe1, iframe2 etc. This allows any scripting code to identify each individual frame on the sheet and we will use these in a moment in some JavaScript.

Now add a drop down list (also known as a combobox). Again you'll see various properties in the dialog box. There is one called "name". For reference, this is the property that will be passed to WebFOCUS as an amper variable. If you reset the value to, say, Country then you would get a variable in WF that was named &Country - note that it would be case specific. In this example you won't need to change it, but it is sufficient that you know this fact.

At the bottom of the properties dialog for the drop down list, you will see a couple of tabs, select the one called parameters. This will allow you to populate tour drop down list. Check the Dynamic radio button in "Control Values" and the ensure "Data Source" is checked. Click the box to the right with the three periods within in and choose CAR.mas from the provided list of synonyms. The list is now set to use the data from CAR.mas. In the field list select COUNTRY and drag it into both the Value and Display field boxes. Notice that your list now has ENGLAND shown within it, this demonstrates that your properties are working OK. Now check the 'Add "ALL" option'.

For this example each frame will use the same fex that should be called testcar.fex and consist of -

TABLE FILE CAR
SUM RCOST DCOST
BY COUNTRY
BY CAR
BY MODEL
WHERE COUNTRY EQ '&Country'
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF, SIZE=9, $
ENDSTYLE
END

Now to set your control action. Click on the "Properties" tab in the properties dialog and ensure that the drop down list is the control that is selected. In this view (properties) and up from the Properties and Parameters tabs, you will see another tab called properties, and alongside it one called events. Click this tab to enter code for the OnChange an event.

Click the cell next to the onchange value and then click the box with three periods. This will take you to the HTML code itself and in particular to a new piece of inserted code between the SCRIPT tags. The new code will consist of a javascript function wrapper ready for you to enter your code and will be called when the drop down list changes. Modify the code to look like this -

function combobox1_onchange(ctrl) {
  document.getElementById("iframe1").src = "/ibi_apps/WFServlet?IBIF_ex=testcar&Country="+document.getElementById("combobox1").value;
  document.getElementById("iframe2").src = "/ibi_apps/WFServlet?IBIF_ex=testcar&Country="+document.getElementById("combobox1").value;
  document.getElementById("iframe3").src = "/ibi_apps/WFServlet?IBIF_ex=testcar&Country="+document.getElementById("combobox1").value;
  document.getElementById("iframe4").src = "/ibi_apps/WFServlet?IBIF_ex=testcar&Country="+document.getElementById("combobox1").value;
}

You might need to add the code "IBIAPP_app=appfolder&" between the "?" and "IBIF_ex" if your app folder is not in your app path.

Save your HTML and run it and you should have a working example. If not then it will be fun to get it going.

I know that I haven't explained how and why the code works as it does, it should provide you with the necessary suuggested searches in the documentation and Google to find out more about it (them).

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 
June 23, 2008, 06:03 AM
MIN27
Hi All,

Thank you very much for the great information, i will be presenting what I have produced today, but cannot wait to get cracking with all your suggestions.
susannah : the HTML book is on the way, I had decided that I needed to get one before but thanks for the advice.

Ill keep you all posted.

Cheers

MIN


Webfocus version 7.6.4
London, England