Focal Point
setting data field as a parameter

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

October 13, 2005, 03:01 PM
<balltr>
setting data field as a parameter
I am looking to grab a data from our database and set it into a variable so that the variable can be reached on a static html page. I have been successfully able to read variables on that html page, but have not been able to set a variable with data from our database. Is there a way to do this? My other option is to just write the html in my fex file using the htmlform command, and print out data fields intermittently throughout the code, but that seems rather sloppy to me. Any advice will be great. I am very new to WebFOCUS, so I thank you in advance for you patience.
October 13, 2005, 03:42 PM
N.Selph
Do a query that gets you one line (the data you want to be in the variable).

FILEDEF HOLDX DISK holdx.dat
TABLE FILE WHATEVER
SUM X
ON TABLE HOLD AS HOLDX
END
-RUN
-READ HOLDX &VAR.A10.
Change A10 to the correct format/length for X.
Now you have it in an amper var, and can put it on the HTML page with !IBI.AMP.VAR;

This message has been edited. Last edited by: <Maryellen>,


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
October 13, 2005, 03:43 PM
Francis Mariani
To retrieve data from a table and make it available as a Dialog Manager variable, you have to TABLE the data, create a SAVE or HOLD file and then -READ the file. The Dialog Manager created by the -READ statement can then be used as a piece of HTML or inserted into a form element using JavaScript.


See the example below:
TABLE FILE CAR
SUM COUNTRY
BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1
ON TABLE HOLD AS H1 FORMAT ALPHA
ON TABLE SET HOLDLIST PRINTONLY
END
-RUN

-READ H1 &COUNTRY.A10.

-HTMLFORM BEGIN

THIS IS A COUNTRY: !IBI.AMP.COUNTRY;


Country:


-HTMLFORM END

This message has been edited. Last edited by: <Maryellen>,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 14, 2005, 07:30 PM
sakeenan
If you have more than one value from your data base you can hold the values as a file for use in your HTML page.

FILEDEF statement
DEFINE FILE CAR
CNTY/A46 = '<OPTION VALUE="' |COUNTRY|| '">' | COUNTYRY |'</OPTION>';
END

TABLE FILE CAR
SUM
CNTY
BY COUNTRY NOPRINT
ON TABLE HOLD AS H1 FORMAT ALPHA
END
-RUN
-HTMLFORM HTMFILE (to call an external HTML file that defines the display page or use -HTMLFORM BEGIN and -HTMLFORM END)
-RUN

Use the following statement in your HTMl file:

<tr><td><select name="country" >!IBI.FIL.H1; </select></td></tr>