×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Validate Data and process IF..THEN GOTO

Validate Data and process IF..THEN GOTO

Validate Data and process IF..THEN GOTO

(OP)
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"
"<NAME "
"<ADD_1 "
"<ADD_2 "
"<ADD_3 "
"<ADD_4 "
"<POST_CODE "
ON TABLE SET ONLINE-FMT HTML
END

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

-INVALIDACCOUNT
-HTMLFORM BEGIN
<HTML>
<HEAD>
<TITLE>TIN BIN 40</TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</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=".../ibiweb.exe" method="GET" target="_parent">
<p align="center"> <br>
  <input type="hidden" name="IBIAPP_app" value="APPDIR">
  <input type="hidden" name="IBIF_ex" value="FOCEXEC">
  <input type="submit" id=RunReport value="Main Report" name="B1">
</form>
<input type=button value="Back" onClick="history.go(-1)">
</BODY>
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD>
</HTML>
-HTMLFORM END




Cheers

Matthew


RE: Validate Data and process IF..THEN GOTO

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.

RE: Validate Data and process IF..THEN GOTO

(OP)
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

RE: Validate Data and process IF..THEN GOTO

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.

RE: Validate Data and process IF..THEN GOTO

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close