Focal Point
[SOLVED] Displaying error page when 0 updates occurred with sql passthru

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

July 23, 2012, 02:33 PM
J
[SOLVED] Displaying error page when 0 updates occurred with sql passthru
I have searched the forums and have seen several posts taking different approaches to capturing the SQL update message. i.e.:


--------------------------------------------------------------------------------

Your request did not return any output to display.
Possible causes:
- No data rows matched the specified selection criteria.
- Output was directed to a destination such as a file or printer.
- An error occurred during the parsing or running of the request.


--------------------------------------------------------------------------------


(FOC1364) ROWS AFFECTED BY PASSTHRU COMMAND : 2/UPDATE

The only instance I care about is when the message returns: 0/UPDATE. I already know about the &&MSGVAR variable which in this case returns FrownerFOC1364) ROWS AFFECTED BY PASSTHRU COMMAND.
The &RECORDS variable, of course, contains 0 since there was no output to display. Is there another way to get that last piece of the error message, or, more importantly, be able to tell it was 0 updates without having to go through the trace files.

Basically if 0 records were updated, I would like to display an error message. Any ideas?
Thanks in advance

This message has been edited. Last edited by: J,


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
July 23, 2012, 03:46 PM
J
Maybe it would be easier with a Modify command?
My code is
 
ENGINE SQLMSS SET DEFAULT_CONNECTION server
SQL SQLMSS
UPDATE table
SET col1 = '&var1'
WHERE col2 = '&var2';
END
-RUN

-IF &&MSGVAR EQ ' (FOC1364) ROWS AFFECTED BY PASSTHRU COMMAND' THEN GOTO SUCCESS;
-INCLUDE COMMON_UPDATEFAILED
-GOTO END_PRGM;
-SUCCESS
-INCLUDE COMMON_UPDATESUCCESS
-END_PRGM
 


The current code covers all that I need except if no updates occur.


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
July 23, 2012, 04:04 PM
J
Always solved after a forum post...
&ROWSAFFECTED is the variable I was looking for

Capturing Rows Affected by Direct SQL Passthru Commands as Dialogue Manager Variables


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs