Focal Point
Multiselect in .fex - simple question
April 12, 2007, 02:07 PM
Jason K.Multiselect in .fex - simple question
I'm trying to set up a multi-select in my .fex so when I create an html form for the ampers in my .fex is will allow more than one value.
I'm new to this, so I'm sure I should know how it works. I've got two ampers...
WHERE YEARMONTH EQ &YEARMONTH.(OR);
WHERE STORE_BUDGETED_NUMBER EQ '&STORE_NUM';
the first line (&YEARMONTH) doesn't error out, so I can only assume it's working as I don't know how to pass more than a single value to it. I can't add the .(OR) to my second line without syntax error because of the ' as it is a character value. Is there any way around this?
Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
April 12, 2007, 02:39 PM
Francis Marianimultisel1.htm
<HTML>
<BODY>
<FORM action="/ibi_apps/WFServlet?" method="GET" target="ReportWindow">
<INPUT name="IBIF_ex" type="hidden" value="MULTISEL1">
<SELECT multiple name="Country" size="4">
<OPTION VALUE="ALL">All Countries</OPTION>
<OPTION VALUE="ENGLAND">England</OPTION>
<OPTION VALUE="FRANCE">France</OPTION>
<OPTION VALUE="ITALY">Italy</OPTION>
<OPTION VALUE="JAPAN">Japan</OPTION>
<OPTION VALUE="W GERMANY">Germany</OPTION>
</SELECT>
<INPUT type="submit" name="Submit" value="Submit">
<INPUT type="reset" name="reset" value="Reset">
</FORM>
</BODY>
</HTML>
multisel1.fex
-SET &ECHO=ALL;
-DEFAULT &Country = 'ALL';
-? &
TABLE FILE CAR
PRINT CAR MODEL BODYTYPE SALES
BY COUNTRY
-IF &Country.EXISTS THEN GOTO SEL_ONE ELSE GOTO SEL_END;
-SEL_ONE
-IF &Country EQ 'ALL' GOTO SEL_END;
WHERE COUNTRY EQ '&Country'
-IF &Country0.EXISTS THEN GOTO SEL_MULT ELSE GOTO SEL_END;
-SET &COUNTER=0;
-SEL_MULT
-REPEAT SEL_MULT_END FOR &COUNTER FROM 2 TO &Country0;
OR '&Country.&COUNTER'
-SEL_MULT_END
-SEL_END
END
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
April 12, 2007, 02:49 PM
Jason K.What if you wanted to pass 'GERMANY' AND 'ENGLAND' but not all countries?
Couldn't you just do a
-IF &COUNTRY EQ 'All' THEN SET &NEW_COUNTRY = 'FOC_NONE'; and let your .fex throw out the where statement, thus returning all values?
I think my entire .fex is wrong if that doesn't work.
Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
April 12, 2007, 02:55 PM
Francis MarianiIf you run my working sample code you will see that it can handle ALL, one or more than one country.
Use the sample code as a beginning for your program.
Create two files in one of your App folders, multisel1.htm and multisel1.fex. Run multisel1.htm with this URL:
http://your-server-name/approot/your-app-name/multisel1.htm 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
April 12, 2007, 03:31 PM
Alan BFrancis
Just a small change needed.
-SET &ECHO=ALL;
-DEFAULT &Country = 'X';
-? &
TABLE FILE CAR
PRINT CAR MODEL BODYTYPE SALES
BY COUNTRY
-SEL_ONE
-IF &Country EQ 'ALL' GOTO SEL_END;
WHERE COUNTRY EQ '&Country'
-IF &Country0.EXISTS THEN GOTO SEL_MULT ELSE GOTO SEL_END;
-SET &COUNTER=0;
-SEL_MULT
-REPEAT SEL_MULT_END FOR &COUNTER FROM 1 TO &Country0;
OR '&Country.&COUNTER'
-SEL_MULT_END
-SEL_END
END
Because &Country will always exist because of the DEFAULT. Then a loop from 1 to &Country0.
Jason, I noticed you have an OR against your &var, are you using auto prompt? If so there is a different approach to take.
And change this line:
-IF &COUNTRY EQ 'All' THEN SET &NEW_COUNTRY = 'FOC_NONE';
to
-SET &NEW_COUNTRY = IF &COUNTRY EQ 'All' THEN 'FOC_NONE' ELSE &COUNTRY;
I think would give you what you need.
Focus DM and TABLE do not allow a IF .. THEN fld = value type syntax.
Alan.
WF 7.705/8.007
April 12, 2007, 03:42 PM
Francis MarianiAlan, you have time to comb through the code with a fine-toothed comb?
Yes, I didn't need the EXISTS line of code. It was probably there because at one time I did not have the -DEFAULT line.
So that's the only change I see: remove one line of redundant code. The program works just fine, with or without the redundant line.
I wrote this little demo before FOC_NONE was around and I usually avoid FOC_NONE if I can, for personal reasons.
Cheers, thanks a lot.
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
April 12, 2007, 03:54 PM
Alan BNot the time Francis, just been there before, sadly.
Must admit I use js to create the screening, I always feel I have more control!
I agree with not using the FOC_NONE. It can cause havoc with compound where clauses.
Alan.
WF 7.705/8.007