Focal Point
[SOLVED] Dialogue Manager problem

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

November 01, 2010, 02:17 PM
Håkan
[SOLVED] Dialogue Manager problem
I've got a problem where DM behaves quite strange. What I'm trying to do is to create a generic proc to handle selection values from a HTML page. Single values work fine and multiple (up to 2) work fine but when I get to the 3rd value it populates the string with ********, and when I come to the 4th it gives me arror.

Below is the trace from the loop. Does anone have a clue what's going on?

-REPEAT :inner_loop 4 TIMES
-SET &val4 = '&' || Fixer || 1 ;
-SET &str = '''' | ANDYBIRD | '''';
-SET &sel_string = IF 1 EQ 1 THEN '''' | ANDYBIRD | ''''
- ELSE IF 1 LE 4 THEN '''' | ' ' | '''' |
- ' OR ' | '''' | ANDYBIRD | '''';
-TYPE sel_string 'ANDYBIRD'
sel_string 'ANDYBIRD'
-TYPE sel_string length 10
sel_string length 10
-SET &Fixer_Sel = 'ANDYBIRD';
-SET &y = 1 + 1;
-REPEAT :inner_loop 4 TIMES
-SET &val4 = '&' || Fixer || 2 ;
-SET &str = '''' | CHRISADAMS | '''';
-SET &sel_string = IF 2 EQ 1 THEN '''' | CHRISADAMS | ''''
- ELSE IF 2 LE 4 THEN '''' | 'ANDYBIRD' | '''' |
- ' OR ' | '''' | CHRISADAMS | '''';
-TYPE sel_string 'ANDYBIRD' OR 'CHRISADAMS'
sel_string 'ANDYBIRD' OR 'CHRISADAMS'
-TYPE sel_string length 26
sel_string length 26
-SET &Fixer_Sel = 'ANDYBIRD' OR 'CHRISADAMS';
-SET &y = 2 + 1;
-REPEAT :inner_loop 4 TIMES
-SET &val4 = '&' || Fixer || 3 ;
-SET &str = '''' | CHRISBLEVINS | '''';
-SET &sel_string = IF 3 EQ 1 THEN '''' | CHRISBLEVINS | ''''
- ELSE IF 3 LE 4 THEN '''' | 'ANDYBIRD' OR 'CHRISADAMS' | '''' |
- ' OR ' | '''' | CHRISBLEVINS | '''';
-TYPE sel_string ********
sel_string ********
-TYPE sel_string length 08
sel_string length 08
-SET &sql_string = ********;
-SET &Fixer_Sel = ********;
-SET &y = 3 + 1;
-REPEAT :inner_loop 4 TIMES
-SET &val4 = '&' || Fixer || 4 ;
-SET &str = '''' | CHRISMITCHELL | '''';
-SET &sel_string = IF 4 EQ 1 THEN '''' | CHRISMITCHELL | ''''
- ELSE IF 4 LE 4 THEN '''' | ******** | '''' |
- ' OR ' | '''' | CHRISMITCHELL | '''';
0 ERROR AT OR NEAR LINE 5 IN PROCEDURE mrheaderFOCEXEC *
(FOC260) AN OPERATION IS MISSING AN ARGUMENT

This message has been edited. Last edited by: Håkan,


WebFOCUS DS 8.0.06/08 DS/AS
WebFOCUS RS 8.0.08 (Linux/IBM i)
WebFOCUS Client 8.0.06 (Linux)
November 01, 2010, 02:32 PM
Francis Mariani
Hakan, please post the actual DM code as well.

Thanks,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 01, 2010, 03:30 PM
j.gross
.. and use the [ code ] [ / code ] tags.

My guess is that you have exraneous .EVAL's in the line that echoed as

-SET &sel_string = IF 3 EQ 1 THEN '''' | CHRISBLEVINS | ''''
- ELSE IF 3 LE 4 THEN '''' | 'ANDYBIRD' OR 'CHRISADAMS' | '''' |
- ' OR ' | '''' | CHRISBLEVINS | '''';
November 02, 2010, 04:36 AM
Håkan
Here's the code:

-*
-SET &ECHO = ALL;
-*
-* Test Strings
-DEFAULTS &Depot = 'FOC_NONE', &Depot_Sql = ' '
-DEFAULTS &Opsman = 'FOC_NONE', &Opsman_Sql = ' '
-DEFAULTS &Site = 'FOC_NONE', &Site_Sql = ' '
-DEFAULTS &Fixer = 'FOC_NONE', &Fixer_Sql = ' '
-SET &Depot = 'FOC_NONE';
-SET &Opsman = 'FOC_NONE';
-SET &Fixer0 = 4;
-SET &Fixer1 = 'ANDYBIRD';
-SET &Fixer2 = 'CHRISADAMS';
-SET &Fixer3 = 'CHRISBLEVINS';
-SET &Fixer4 = 'CHRISMITCHELL';
-SET &Parm_Count = 3;
-SET &Parm_String = 'Depot^Opsman^Fixer';
-* End Test Strings
-*
-SET &x1 = 1;
-SET &x2 = &Parm_Count;
-*
-:init
-DEFAULT &sel_string = ' ';
-DEFAULT &sql_string = ' ';
-SET &parm_len = &Parm_String.LENGTH;
-SET &parm_frm = 'A' | &parm_len;
-*
-REPEAT :end_loop FOR &x1 FROM 1 TO &x2
-SET &single_name = ' ';
-SET &val = GETTOK(&Parm_String, &parm_len, &x1, '^', &parm_len, '&parm_frm');
-SET &xtest = '&' | &val || '0.EXIST';
-IF &xtest.EVAL GOTO :multi;
-SET &val2 = '&' | &val;
-SET &len = ARGLEN(&val2.LENGTH, &val2, 'I3') - 1;
-SET &fmt = 'A' | &len;
-SET &val3 = SUBSTR(&len, &val, 1, &len, &len, '&fmt');
-SET &val4 = '&' || &val3 ;
-SET &str = '''' | &val4.EVAL | '''';
-SET &sel_string = IF &val4.EVAL CONTAINS FOC_NONE THEN '''' | ' ' | '''' ELSE '''' | &str.EVAL | '''';
-SET &sql_string = &sel_string;
-SET &selvar = '&' || &val.EVAL || '_Sel' ;
-SET &sqlvar = '&' || &val.EVAL || '_Sql' ;
-SET &selvar.EVAL = IF &sel_string.EVAL EQ ' ' THEN &sel_string.EVAL ELSE &sel_string.QUOTEDSTRING;
-SET &selvar.EVAL = &selvar.EVAL;
-GOTO :end_loop
-*
-:multi
-SET &y = 1;
-SET &str = ' ';
-SET &z = '&' | &val || '0';
-SET &len = ARGLEN(&val.LENGTH, &val, 'I3');
-SET &fmt = 'A' | &len;
-SET &val3 = SUBSTR(&len, &val, 1, &len, &len, '&fmt');
-SET &selvar = '&' || &val.EVAL || '_Sel' ;
-SET &sqlvar = '&' || &val.EVAL || '_Sql' ;
-*
-REPEAT :inner_loop &z.EVAL TIMES
-SET &val4 = '&' || &val3 || &y ;
-SET &str = '''' | &val4.EVAL | '''';
-SET &sel_string = IF &y EQ 1 THEN '''' | &val4.EVAL | '''' 
- ELSE IF &y LE &z.EVAL THEN '''' | &sel_string.EVAL | '''' |
- ' OR ' | '''' | &val4.EVAL | '''';
-TYPE sel_string        &sel_string
-TYPE sel_string length &sel_string.LENGTH
-SET &sql_string = &sel_string;
-SET &selvar.EVAL = &sel_string;
-SET &sqlvar.EVAL = &sql_string;
-SET &y = &y + 1;
-:inner_loop
-*
-:end_loop



WebFOCUS DS 8.0.06/08 DS/AS
WebFOCUS RS 8.0.08 (Linux/IBM i)
WebFOCUS Client 8.0.06 (Linux)
November 02, 2010, 05:39 AM
GamP
Try it with this piece of code:
-SET &sel_string = IF &y EQ 1 THEN '''' | &val4.EVAL | '''' 
- ELSE IF &y LE &z.EVAL THEN &sel_string |
- ' OR ' | '''' | &val4.EVAL | '''';



GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
November 02, 2010, 09:19 AM
Håkan
Gerard

thanks heaps. It's amazing what a couple of qoutes can do. Now it's working exactly as I wanted.

Håkan


WebFOCUS DS 8.0.06/08 DS/AS
WebFOCUS RS 8.0.08 (Linux/IBM i)
WebFOCUS Client 8.0.06 (Linux)
November 02, 2010, 11:21 AM
j.gross
My conjecture was well founded.
quote:
-SET &sel_string = IF &y EQ 1 THEN '''' | &val4.EVAL | ''''
- ELSE IF &y LE &z.EVAL THEN '''' | &sel_string.EVAL | '''' | ' OR ' | '''' | &val4.EVAL | '''';


The .EVAL in &sel_string.EVAL is extraneous, and tripped you up.

Without .EVAL, the content of the referenced amper variable is used only after the right-hand-side expression has been parsed; with .EVAL the the contents of the amper var is treated as if it were in the original content of the line of code.

So, with .EVAL, when the value contained in &sel_string included an operator (such as " OR " or "*"), it got treated as such.

In iteration 2 of the loop, " OR " was introduced.
In iteration 3, the presence of OR caused the interpreter to store a numeric result; since the expression was malformed, the result was a number that overflowed (rather than the 0 or 1 that OR should yield), and asterisks were stored.
In iteration 4, .EVAL caused those asterisks to be treated as a numeric operator, and the music stopped with "(FOC260) AN OPERATION IS MISSING AN ARGUMENT"