Focal Point
[SOLVED] create popup box with &ERRMSG displayed

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

February 22, 2011, 12:37 PM
mpbMDE
[SOLVED] create popup box with &ERRMSG displayed
In my focexec, there is an error checking routine (did the selection result in 0 records, etc). I'd like to send the error message to a popup box that has the &ERRMSG in it and an 'ok' button to return to the launch page. The &ERRMSG can be passed from the focexec and an HTMLFORM could be used to open the popup. I just don't have the code to create a popup box. If anyone can help me, I'd sure appreciate it! (I am javascript illiterate.)
Marilyn

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


WebFOCUS 8.1.05 Windows 7, all output
February 22, 2011, 04:30 PM
Waz
I think that you will have to start reading up on javascript, as you will need it.

The most simple return is:
-SET &ERRMSG = 'Error Found' ;
-IF &FOCERRNUM NE 0 THEN GOTO ERROR ;
.
.
.
-ERROR
-HTMLFORM BEGIN
  <script language="JavaScript">
  <!--
    alert(&ERRMSG)
  //-->
-HTMLFORM END



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

February 23, 2011, 01:40 AM
Ramkumar - Webfous
Tabbab
-IF &FOCERRNUM NE 0 THEN :ERR;

-:ERR
-HTMLFORM BEGIN
<script>
var alertval = 'Error occured and it is ' + !IBI.AMP.FOCERRNUM;
alert(alertval);
</script>
-HTMLFORM END



Something of this sort basically...

Or If you dont want to go for custom JS alert, just think for a resizes and customized window.open() winodow or a Dynamic popup using
tag...


Thanks,

Ramkumar.
WebFOCUS/Tableau
Webfocus 8 / 7.7.02
Unix, Windows
HTML/PDF/EXCEL/AHTML/XML/HTML5
Thanks!
I took WAZ's idea:
WITHIN FEX:

-ERRCHECK
"be SURE to reset &ERRMSG at the top of error checking"
-SET &ERRMSG = '';
-SET &ERRMSG = IF &LINES EQ 0 THEN
'No Data Found For Your Selecton' ;
-SET &ERRMSG = IF ..... THEN 'Error Text' ;
-IF &ERRMSG NE '' THEN GOTO ERROR ;
.
.
.
-ERROR
-HTMLFORM BEGIN
<script language="JavaScript">
alert(&ERRMSG.EVAL)

-HTMLFORM END
-EXIT

The first error will show up in the popup box. If there are multiple errors, the next one will show up on the next attempt to execute the fex, etc.


WebFOCUS 8.1.05 Windows 7, all output
You could also build a list of messages.

By adding each error message to the &ERRMSG variable, and separate each one with '\n', a new line, you can have a better message.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

Sounds good, Waz: Can you show me an example?


WebFOCUS 8.1.05 Windows 7, all output
Here is an example of building the list.

-SET &ERRMSG = ' ' ;
-SET &ERRMSG = IF {condition} THEN &ERRMSG || 'My First Error\n' ELSE &ERRMSG ;
.
.
-SET &ERRMSG = IF {condition} THEN &ERRMSG || 'My Second Error\n' ELSE &ERRMSG ;
.
.
-SET &ERRMSG = IF {condition} THEN &ERRMSG || 'My Other Error\n' ELSE &ERRMSG ;
.
.
-IF &ERRMSG NE ' ' THEN GOTO ERROR ;
.
.
.
-ERROR
-HTMLFORM BEGIN
  <script language="JavaScript">
  <!--
    alert(&ERRMSG)
  //-->
-HTMLFORM END


The \n in the text creates a new line in the javascript alert.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!