Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to include a field from a hold file in an embedded html in a fex?

Status
Not open for further replies.

labanks

Programmer
Mar 24, 2006
2
0
0
US
Here is the code of what I am trying to do. I want to pull only the Project Number field from the hold file onto my html form. Any help would be greatly appreciated!

SET SQLENGINE=SQLORA
SQL SET SERVER &MYSERV

SQL SELECT
det.AGREEMENT_NUM,
det.PROJECT_NUMBER,
det.DURATION
FROM AGREE_DETAIL det
WHERE det.AGREEMENT_NUM = '018060621';

TABLE
ON TABLE HOLD AS INVOICE
END
-RUN

-HTMLFORM BEGIN
<HTML>
<TITLE>ADVANCED FUNDS INVOICE REQUEST</TITLE>
<HEAD><CENTER><STRONG>ADVANCED FUNDS INVOICE REQUEST</STRONG></HEAD>
<HR WIDTH=640>
<BODY>
<TABLE WIDTH=85% BORDER=0>
<tr><td>TO: </td>
<td>Dept. 9513</td>
<td>FROM:</td>
<td>Dept. 9112</td></tr>
<tr><td>NAME:</td>
<td>Margie Shuford</td>
<td>PROJ NUM:</td>
<td>!IBI.FIL.INVOICE.PROJECT_NUMBER;</td></tr>
</BODY>
</HTML>
 
First of all, there's nothing in your request to prevent MULTIPLE values of Project Num from being stored in the HOLD file. So, assuming the same value of PROJECT_NUM is on each record in the file, here's what I would do. Since this is an SQL SELECT, you don't know the formats of the fields beforehand (you may, but they could change). So, once you've held all the data, I'd create a second HOLD file from the first, with just one project number. To do this, issue the following:

Code:
TABLE FILE INVOICE
PRINT PROJECT_NUMBER
ON TABLE HOLD AS PROJNUM FORMAT ALPHA
WHERE RECORDLIMIT EQ 1
END
-RUN

This will write out the first instance of PROJECT_-NUMBER to a file called PROJNUM, and will save it as character format (if it was numeric, you DON'T want it in internal/binary format). The final '-RUN' executes the commands.

Then, issue the following:

Code:
-READ PROJNUM,&PROJECT_NUM

This will read the first (and only) value in that file into a Dialogue Manager variable called &PROJECT_NUM. From then on, you can use this value (as !IBI.AMP.PROJECT_NUM;) in your HTMLFORM.


 
Thank you for your help. However, is there a way to specifically pull from the table and not have to write to a variable? The example I provided is very streamlined. I really need to do this on about 30 fields and was trying to avoid creating variables.
 
Well, by definition, the values you want to include are variables (they may have differing values). The only other way is to have your output LOOK like an HTML form, and then -INCLUDE that. It's more complex, and using a variable is much easier to create, and modify. Is there any reason NOT to use variables? My example was for a single variable; it could just as well read all 30 variables. You either extract them in a FIXED format, and read them in with a length specification for each field:

Code:
-READ extractfile &VAR1.A10. &VAR2.A5. &VAR3.A1.

or write them out comma delimited, and read them in free-format:

Code:
-READ extractfile, &VAR1 &VAR2 &VAR3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top