IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    Multiselect in .fex - simple question
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Master
Posted
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 Win2003 Server running Webfocus 7.6.2 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
 
Posts: 541 | Registered: January 04, 2007Reply With QuoteEdit or Delete MessageReport This Post
Expert
Posted Hide Post
multisel1.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



Env 1: WebFOCUS 5.3.2 Servlet - MRE/BID/Self Service/ReportCaster - MS Windows Server 2003 - IIS/New Atlanta ServletExec - MS SQL Server 2000 - DataMigrator 5.3.4
Env 2: WebFOCUS 7.6.5 Servlet - MRE/BID/Self Service - MS Windows XP SP2 - Apache Tomcat/5.5.25 - MS SQL Server 2000
Env 3: WebFOCUS 5.3.3 CGI - Self Service - AIX 5.2 - IBM DB2
Output formats: HTML, Excel 2000 and PDF
 
Posts: 3379 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteEdit or Delete MessageReport This Post
Master
Posted Hide Post
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 Win2003 Server running Webfocus 7.6.2 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
 
Posts: 541 | Registered: January 04, 2007Reply With QuoteEdit or Delete MessageReport This Post
Expert
Posted Hide Post
If 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



Env 1: WebFOCUS 5.3.2 Servlet - MRE/BID/Self Service/ReportCaster - MS Windows Server 2003 - IIS/New Atlanta ServletExec - MS SQL Server 2000 - DataMigrator 5.3.4
Env 2: WebFOCUS 7.6.5 Servlet - MRE/BID/Self Service - MS Windows XP SP2 - Apache Tomcat/5.5.25 - MS SQL Server 2000
Env 3: WebFOCUS 5.3.3 CGI - Self Service - AIX 5.2 - IBM DB2
Output formats: HTML, Excel 2000 and PDF
 
Posts: 3379 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteEdit or Delete MessageReport This Post
Master
Posted Hide Post
Francis

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.6.5, PMF 5.1, MRE,RA,RG, etc... Win2003(8xQuad)/IIS/Tomcat with SSL and AD security.
 
Posts: 848 | Location: Portugal | Registered: February 07, 2007Reply With QuoteEdit or Delete MessageReport This Post
Expert
Posted Hide Post
Alan, 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



Env 1: WebFOCUS 5.3.2 Servlet - MRE/BID/Self Service/ReportCaster - MS Windows Server 2003 - IIS/New Atlanta ServletExec - MS SQL Server 2000 - DataMigrator 5.3.4
Env 2: WebFOCUS 7.6.5 Servlet - MRE/BID/Self Service - MS Windows XP SP2 - Apache Tomcat/5.5.25 - MS SQL Server 2000
Env 3: WebFOCUS 5.3.3 CGI - Self Service - AIX 5.2 - IBM DB2
Output formats: HTML, Excel 2000 and PDF
 
Posts: 3379 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteEdit or Delete MessageReport This Post
Master
Posted Hide Post
Not 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.6.5, PMF 5.1, MRE,RA,RG, etc... Win2003(8xQuad)/IIS/Tomcat with SSL and AD security.
 
Posts: 848 | Location: Portugal | Registered: February 07, 2007Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    Multiselect in .fex - simple question

Copyright © 1996-2008 Information Builders, leaders in enterprise business intelligence.