i am using the following if else statement -SET &w = IF &Text.&I.A150 CONTAINS "some text" THEN PRINT "hello" ELSE PRINT "helloq1";
i dont understand what is the error its giving IF ..THEN..ELSE synatx error please helpThis message has been edited. Last edited by: <Kathryn Henning>,
WEBFOCUS 8.0
July 09, 2015, 10:10 AM
Francis Mariani
I won't debug the rest of the -SET statement, but since it is a multi-line Dialogue Manager command, each subsequent line must begin with "- ".
-SET &w = IF &Text.&I.A150 CONTAINS "some text"
- THEN PRINT "hello"
- ELSE PRINT "helloq1";
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
July 09, 2015, 10:14 AM
Tomsweb
I don't think you can declare the size of an amper variable. Furthermore, you are using an indexed variable. Does &I have a value?
Please declare &I=1; and remove A150. Then try it and see what happens. Also put -SET &ECHO=ALL at the very top of your code to observe this result in detail.
ERROR MESSAGE :- 0 ERROR AT OR NEAR LINE 29 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC266) IF .. THEN .. ELSE .. SYNTAX ERROR
WEBFOCUS 8.0
July 09, 2015, 10:20 AM
John_Edwards
PRINT in that context is new to me. Is that correct syntax?
For giggles remove the two PRINTs. That's what I would have done. Should set &w to the correct value.
What does it look like in the code with the amper-variables resolved by the way? -SET ECHO=ALL at the top and show us what the command going to the parser looks like.This message has been edited. Last edited by: John_Edwards,
July 09, 2015, 10:24 AM
Tomsweb
Instead of the print command where you've coded put GOTO PrintIt. The code a -PrintIt label, where you'd code the print XXX command, followed by -EXIT to leave the program.
-SET &MAS_COUNT = &LINES; -REPEAT :MAS_READ FOR &I FROM 1 TO &MAS_COUNT; -READ mymaster &Text.&I.A80 -SET &w = IF &Text.&I CONTAINS "sometext" -THEN GOTO Printit -ELSE GOTO REPEAT; -*IF &IORETURN NE 0 THEN GOTO END_READ; -TYPE text =&Text.&I.A80 -:MAS_READ
-Printit PRINT "Hello" -EXIT
If it dosent match i want to continue the looping
WEBFOCUS 8.0
July 09, 2015, 10:35 AM
Francis Mariani
It looks like your ELSE statement does not have "- " before it.
And PRINT is not a Dialogue Manager command.
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
July 09, 2015, 11:15 AM
Tomsweb
Below the -PrintIt section you have only 2 options for output.... 1. Issue a table request to print a report, or 2. Issue a -TYPE &variable . Or, -TYPE Hello
-SET &MAS_COUNT = &LINES; -REPEAT :MAS_READ FOR &I FROM 1 TO &MAS_COUNT; -READ mymaster &Text.&I.A80 -SET &w = IF &Text.&I CONTAINS "sometext" THEN GOTO Printit ELSE GOTO REPEAT; -*IF &IORETURN NE 0 THEN GOTO END_READ; -TYPE text =&Text.&I.A80 -:MAS_READ
-Printit -TYPE hello -EXIT
My question is is the IF statement correst?? can i issue GOTO REPEAT in the ELSE ??
As my Error is
0 ERROR AT OR NEAR LINE 29 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC266) IF .. THEN .. ELSE .. SYNTAX ERROR
My line 29 is -SET &w = IF &Text.&I CONTAINS "sometext" THEN GOTO Printit ELSE GOTO REPEAT;
WEBFOCUS 8.0
July 09, 2015, 11:29 AM
Tomsweb
What do you with the &w variable? It seems to me you should code: -IF &text.&I eq ... Then GOTO ...ELSE ...