Focal Point
misc

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

March 21, 2007, 08:16 AM
Aditya
misc
Hi,

I have the following requirement.I execute a database stored procedure that processes data from the database and inserts a single record in a table say XYZ with the field COUNT updated to the no. of records processed.There are cases when there is no data to process in the database.In such a case the SP inserts a single record in the XYZ table as usual and updates COUNT to 0.

Now depending upon the count i want to display the user an appropriate screen(i.e when the COUNT is not zero i want to proceed to some other screen as i am doing right now but when the COUNT is zero i want to take the user to the error page).The following is my present code.The DB_PROC_1 procedure is the one that processes the data and inserts a single record in the XYZ table and updates COUNT to an appropiate value.

Now i want to know how to fire a second query(i.e select COUNT from XYZ where DATA_KEY=(the one returned by DB_PROC_1)) to check the value of COUNT variable in database and go ahead with the processing.

-INCLUDE db_connection_file

EX DB_PROC_1 param1,param2...,paramN;

TABLE FILE SQLOUT
PRINT
COMPUTE PR_NO/A15 = FTOA(DATA_KEY, '(F4)', PR_NO);
    COMPUTE OPTION1/A100 =
     '<option value="' || PR_NO || '">' || PR_NO || '</option>' ;
  ON TABLE HOLD AS REPORT FORMAT ALPHA
END
-RUN

-HTMLFORM BEGIN
<HTML>
<BODY>
<select name="REPNO">
  !IBI.FIL.REPORT;
</select>
<BODY>
</HTML>

March 27, 2007, 10:15 AM
Jason K.
do a simple
-IF someamper EQ '0' then goto my_ref_for0s else goto non_0;
-my_ref_for0s
some -htmlform that will auto redirect to your error page.

-non_0
some -htmlform that will auto redirect to your non-error page.


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
March 27, 2007, 10:41 AM
Qalqili
Hi Aditya

Jason K is right you need to use Dialog manager Code -IF to make condintional jump like:-

TABLE FILE XYZ
PRINT *
WHERE COUNT EQ 0
ON TABLE HOLD
END
-RUN
-IF &RECORDS EQ 0 GOTO -ERRORMSG ELSEL GOTO -DISPLAYMSG
-RUN
-ERRORMSG
-HTMLFORM BEGIN


ERROR Message
-HTMLFORM END
-EXIT
-DISPLAYMSG
-HTMLFORM BEGIN


Your Message where Count Greater than 0
-HTMLFORM END
-EXIT

Hope this will help


WF 7.7.0.3HF3 / WinXP- WF-Client & Apache / DevStd 7.7.0.3HF3 win XP.