Focal Point
[SOLVED] 9 where statements for 9 checked boxes

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

October 22, 2009, 04:16 PM
Kathy P
[SOLVED] 9 where statements for 9 checked boxes
Hi,
I have been searching and have not been able to find a case identical to mine. I have 9 boxes a user can check. The boxes represent the different types of owners that are in the database. If more than one box is checked, I want all the records that meet one or more of the checked boxes. so all my where statements would need an 'OR' between each one. However, I cannot use foc_none because then the whole line is ignored when it sees a single foc_none. If they check one box, they don't need an 'or'. But if they check 3 boxes, I need a where statement for each box separated by 'OR'. It is handling the OR I am having a problem with. The only thing I could come up with is to have a counter and increase it once I add the second where statemnt, thus I can code an 'OR' in there if the cntr is greater than 1. I am using dialog mgr to navigate around each statement. Any other suggestions or better ideas?

Thank you.

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


Kathy Phillips
Web FOCUS 8.2.05.14, 8.1.05, 8.08, 8.0.7, 8.0.5,8.0.2m, 7.6.10,7.7.03
Windows
October 22, 2009, 04:24 PM
GinnyJakes
Generate the WHERE statement dynamically in Dialogue Manager checking all of your conditions and then use that variable in the TABLE part.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
October 22, 2009, 06:09 PM
Darin Lee
Just make sure that each separate OR criteria is on its own line. A 'FOC_NONE' doesn't cause the whole WHERE to be ignored only the single PHYSICAL line of code in which it appears.

WHERE
fieldname EQ 'value'
OR fieldname EQ 'value'
.
.
.
;


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
October 23, 2009, 05:57 AM
Tewy
You could use IN instead of OR
e.g.

WHERE fieldname IN (
&var1
&var2
&var3
)

You can then use FOC_NONE as long as at least one &var has a value.


WF 7.6.11
Output: HTML, PDF, Excel
October 23, 2009, 08:01 AM
Kathy P
Darin,
Thank you for your input. I did have each filter on it's own line using foc_none and my output results were not correct. It did occur to me my first two screening conditions, one of them would always be used. There is only one business size check box on the html. Therefore, I could prefix the rest of the filters with 'or'. Here is what I did. Ginny, thanks for your suggestion. Being the end of the day, sometimes I need another set of eyes.

-SET &WHERE1=IF &COMPANY_SMALL_BUSINESS EQ 'YES' THEN 'WHERE (COMPANY_SMALL_BUSINESS EQ ''YES'')' ELSE ' ';
-SET &WHERE2=IF &COMPANY_LARGE_BUSINESS EQ 'YES' THEN 'WHERE (COMPANY_LARGE_BUSINESS EQ ''YES'')' ELSE ' ';
-SET &WHERE3=IF &COMPANY_SDB EQ 'YES' THEN 'OR (COMPANY_SDB EQ ''YES'')' ELSE ' ';
-SET &WHERE4=IF &COMPANY_8A EQ 'YES' THEN 'OR(COMPANY_8A EQ ''YES'')' ELSE ' ';
-SET &WHERE5=IF &COMPANY_WOMAN_OWNED EQ 'YES' THEN 'OR(COMPANY_WOMAN_OWNED EQ ''YES'')' ELSE ' ';
-SET &WHERE6=IF &COMPANY_VETERAN_OWNED EQ 'YES' THEN 'OR(COMPANY_VETERAN_OWNED EQ ''YES'')' ELSE ' ';
-SET &WHERE7=IF &COMPANY_HUB_ZONE EQ 'YES' THEN 'OR(COMPANY_HUB_ZONE EQ ''YES'')' ELSE ' ';
-SET &WHERE8=IF &COMPANY_HBCU EQ 'YES' THEN 'OR(COMPANY_HBCU EQ ''YES'')' ELSE ' ';
-SET &WHERE9=IF &COMPANY_FOREIGN EQ 'YES' THEN 'OR(COMPANY_FOREIGN EQ ''YES'')' ELSE ' ';
-SET &WHERE10=IF &COMPANY_MINORITY EQ 'YES' THEN 'OR(COMPANY_MINORITY EQ ''YES'')' ELSE ' ';
-SET &WHERE11=IF &COMPANY_DIS_VET EQ 'YES' THEN 'OR(COMPANY_DIS_VET EQ ''YES'')' ELSE ' ';
-SET &WHERE12=IF &COMPANY_NON_PROFIT EQ 'YES' THEN 'OR(COMPANY_NON_PROFIT EQ ''YES'')' ELSE ' ';
-SET &WHERE13=IF &COMPANY_NATIVE_AMERICAN EQ 'YES' THEN 'OR(COMPANY_NATIVE_AMERICAN EQ ''YES'')' ELSE ' ';
-SET &WHERE14=IF &COMPANY_ALSAKAN_NATIVE EQ 'YES' THEN 'OR(COMPANY_ALSAKAN_NATIVE EQ ''YES'')' ELSE ' ';
-SET &WHERE15= ';';
-*
Have a super fantastic day!

Kathy

This message has been edited. Last edited by: Kathy P,


Kathy Phillips
Web FOCUS 8.2.05.14, 8.1.05, 8.08, 8.0.7, 8.0.5,8.0.2m, 7.6.10,7.7.03
Windows