Kbase P22964: How to assign variables from a file with list-item-pairs in
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  11/25/2003 |
|
Status: Unverified
GOAL:
How to assign variables from a file with list-item-pairs in Webspeed
FIX:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<META NAME="AUTHOR" CONTENT="Alex Pearlstein">
<TITLE>How to retreive contents from a file</TITLE>
<SCRIPT LANGUAGE="SpeedScript">
/* Create an unnamed pool to store all the widgets created by this procedure.
This is a good default which assures that this procedure's triggers and
internal procedures will execute in this procedure's storage, and that
proper cleanup will occur on deletion of the procedure. */
CREATE WIDGET-POOL.
DEFINE VARIABLE custid as CHARACTER.
DEFINE VARIABLE fileid as CHARACTER.
Define Variable entrybuffer as c.
Define variable numselected as integer.
DEFINE VARIABLE tcustnum as CHARACTER.
DEFINE VARIABLE tstate as CHARACTER.
DEFINE VARIABLE taddress as CHARACTER.
DEFINE VARIABLE tname as CHARACTER.
DEFINE VARIABLE tcity as CHARACTER.
def var x as c.
Def var ctr as i.
PROCEDURE output-header:
Assign custid = get-value("cid")
fileid = "c:\temp\" + String(custid) + ".txt".
Input from value(fileID).
repeat:
Import x.
CASE entry(1, x, "="):
WHEN "tcustnum" THEN
assign tcustnum = url-decode(entry(2, x, "=")).
WHEN "tstate" THEN
assign tstate = url-decode(entry(2, x, "=")).
WHEN "taddress" THEN
assign taddress = url-decode(entry(2, x, "=")).
WHEN "tcity" THEN
assign tcity = url-decode(entry(2, x, "=")).
END CASE.
END.
Input close.
END Procedure.
</SCRIPT>
</HEAD>
<BODY>
<Form method="POST" Name="logon" action="Example_readfromfile.html">
<table>
<TR><TD>number</TD><TD><input type="text" size="20" name="tcustNum" value="` tcustNum `"></TD></TR>
<TR><TD>State</TD><TD><input type="text" size="20" name="tstate" value="` tstate `"></TD></TR>
<TR><TD>Address</TD><TD> <input type="text" size="20" name="taddress" value="` taddress `"></TD></TR>
<TR><TD>city</TD><TD> <input type="text" size="20" name="tcity" value="` tcity `"></TD></TR>
</table>
<BR>
<BR>
</BODY>
</HTML>