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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate Data and process IF..THEN GOTO

Status
Not open for further replies.

MJPPaba

MIS
May 28, 2003
142
GB
Using WF 521 I have this urgent problem. Please help anyone.

I have a single line recordset being returned as a report.
I have to validate the account number so that if the value of Account number = 0 then goto a placeholder called -INVALIDACCOUNT, else continue with code.

This is what I have so far...


SET SQLENGINE=SQLMSS
ENGINE SQLMSS SET DEFAULT_CONNECTION DEFCONN

SQL EX myStoredProcedureName;
-IF ACCOUNT = 0 THEN GOTO INVALIDACCOUNT;
TABLE FILE SQLOUT
PRINT ACCOUNT
ON TABLE HOLD AS MYFILE
END
DEFINE FILE MYFILE
DUMMYFIELD/A1=' ';
END
TABLE FILE MYFILE
PRINT
DUMMYFIELD NOPRINT
-*DUMMYFIELD REQD BECAUSE GUI HAS A BUG WHERE THE REPORT IS LOST IF NO REPORT BODY IS ENTERED.
HEADING
"CUSTOMER DETAILS"
&quot;<NAME &quot;
&quot;<ADD_1 &quot;
&quot;<ADD_2 &quot;
&quot;<ADD_3 &quot;
&quot;<ADD_4 &quot;
&quot;<POST_CODE &quot;
ON TABLE SET ONLINE-FMT HTML
END

-HTMLFORM BEGIN
<HTML>
<HEAD>
<TITLE>TIN BIN 40</TITLE>
<META HTTP-EQUIV=&quot;Pragma&quot; CONTENT=&quot;no-cache&quot;>
<META HTTP-EQUIV=&quot;Expires&quot; CONTENT=&quot;-1&quot;>
</HEAD>
<BODY>
<table>
<tr>
<td>
!IBI.FIL.MYFILE;
</td>
<td>
<form action=&quot;.../ibiweb.exe&quot; method=&quot;GET&quot; target=&quot;_parent&quot;>
<p align=&quot;center&quot;><br>
<input type=&quot;hidden&quot; name=&quot;IBIAPP_app&quot; value=&quot;APPDIR&quot;>
<input type=&quot;hidden&quot; name=&quot;IBIF_ex&quot; value=&quot;FOCEXEC&quot;>
<input type=&quot;submit&quot; id=RunReport value=&quot;Commit&quot; name=&quot;B1&quot;>
</form>
<input type=button value=&quot;Back&quot; onClick=&quot;history.go(-1)&quot;>
</BODY>
<HEAD>
<META HTTP-EQUIV=&quot;Pragma&quot; CONTENT=&quot;no-cache&quot;>
<META HTTP-EQUIV=&quot;Expires&quot; CONTENT=&quot;-1&quot;>
</HEAD>
</HTML>
-HTMLFORM END
-EXIT

-INVALIDACCOUNT
-HTMLFORM BEGIN
<HTML>
<HEAD>
<TITLE>TIN BIN 40</TITLE>
<META HTTP-EQUIV=&quot;Pragma&quot; CONTENT=&quot;no-cache&quot;>
<META HTTP-EQUIV=&quot;Expires&quot; CONTENT=&quot;-1&quot;>
</HEAD>
<BODY>
<table>
<tr>
<td>
SORRY, THE ACCOUNT YOU HAVE SELECTED IS INVALID<BR>
PLEASE RETURN TO THE PREVIOUS SCREEN USING THE BACK BUTTON,<BR>
AND CHECK THE ACCOUNT NUMBER.<BR><BR>
ALTERNATIELY PLEASE CLICK THE MAIN REPORT BUTTON TO REFRESH THE SCREEN.</td>
<td>
<form action=&quot;.../ibiweb.exe&quot; method=&quot;GET&quot; target=&quot;_parent&quot;>
<p align=&quot;center&quot;> <br>
<input type=&quot;hidden&quot; name=&quot;IBIAPP_app&quot; value=&quot;APPDIR&quot;>
<input type=&quot;hidden&quot; name=&quot;IBIF_ex&quot; value=&quot;FOCEXEC&quot;>
<input type=&quot;submit&quot; id=RunReport value=&quot;Main Report&quot; name=&quot;B1&quot;>
</form>
<input type=button value=&quot;Back&quot; onClick=&quot;history.go(-1)&quot;>
</BODY>
<HEAD>
<META HTTP-EQUIV=&quot;Pragma&quot; CONTENT=&quot;no-cache&quot;>
<META HTTP-EQUIV=&quot;Expires&quot; CONTENT=&quot;-1&quot;>
</HEAD>
</HTML>
-HTMLFORM END




Cheers

Matthew


 
Matthew,

What is your question? Based on what you did provide;

SET SQLENGINE=SQLMSS
ENGINE SQLMSS SET DEFAULT_CONNECTION DEFCONN

SQL EX myStoredProcedureName;
-IF ACCOUNT = 0 THEN GOTO INVALIDACCOUNT;

ACCOUNT probably needs to be &ACCOUNT, and a -RUN needs to precede the -IF statement. Also, I presume myStoredProcedureName is supposed to provide the value for &ACCOUNT. I don't see how it can do this. SQL can return an answer set, but I don't think its going to give a value to an & variable.

By the way, DM will probably think ACCOUNT without the & is a character string. Therefore, ACCOUNT can never equal 0.
 
My problem is..

1. Launch Page 1 includes a form. The URL for the problem page above has the AMPVariable &ACCOUNT.

2. The stored Procedure returns a single line recordset.

ACCOUNT,NAME,ADDRESS...etc

2.1 The Sproc either returns ACCOUNT = &ACCOUNT or ACCOUNT <>&ACCOUNT.
I want WF to evaluate ACCOUNT = &ACCOUNT
therefore
2.2 If ACCOUNT <> &ACCOUNT then goto -invalidaccount

I hope this kind of clears up my problem!

Cheers
Matthew
 
In that case, you probably want something like:

SET SQLENGINE=SQLMSS
ENGINE SQLMSS SET DEFAULT_CONNECTION DEFCONN

SQL EX myStoredProcedureName;
-RUN
-READ yourfilename &ACCOUNT.A??. &NAME.A??. etc.
-IF &ACCOUNT = 0 THEN GOTO INVALIDACCOUNT;

where the '??' is the length of that value. Like A10 if &ACCOUNT is 10 bytes long. I'm assuming that the single line recordset is alpha. If not, you'll need to convert it so DM can use it.
 
Matthew,

I have encountered problems when the label reference of the GOTO is greater than 12 characters long. So shorten your INVALIDACCOUNT label to 12 chars or less.

Regards,
Sean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top