Focal Point
[SOLVED] Listbox value to match Substring in WHERE statement

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

October 30, 2012, 06:53 PM
sxschech
[SOLVED] Listbox value to match Substring in WHERE statement
I've spent several hours on this and not sure what I'm doing wrong. I would like to provide a list box with the options of All, Yes, No. The All option works, what is supposed to happen with Yes is that it would evaluate to '5' and No would evaluate to '0' and be included in a where clause that looks at the last character.

If I choose All, the report runs. If I chose Yes or No, I get an error message:

ERROR AT OR NEAR LINE     37  IN PROCEDURE XGO9OOYRFOCEXEC *
 (FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: Yes
 BYPASSING TO END OF COMMAND
 (FOC009) INCOMPLETE REQUEST STATEMENT


Same message as above when choosing No except for ... NOT RECOGNIZED: No


This is what is on line 37:

  
WHERE SUBSTR(10,ACADEMIC_PERIOD,6,1,1,'A1') EQ &USF_ONLINE.(<All,_FOC_NULL>,<Yes,5>,<No,0>).ONLINETERM.;


All the other Where Statements are also using List Boxes and run fine. Is Substr not the right command to use?

WHERE RESIDENCY EQ '&RESIDENCY.(<All,_FOC_NULL>,<Domestic,D>,<International,I>).RESIDENCY.';
WHERE COLLEGE EQ &COLLEGE.(OR(<LA,LA>,<SC,SC>,<AM,AM>,<BU,BU>,<NS,NS>,<ED,ED>,<PL,PL>,<LW,LW>)).COLLEGE.;
WHERE STU_POPULATION EQ &STU_POPULATION.(OR(<Freshman,F>,<Transfer,T>,<Graduate,G>,<Doctorate,D>,<First-Year Law,1>,<LLM-Masters of Law,L>,<2+2,P>)).STU_POPULATION.;
WHERE APPLICATION_STATUS EQ &APPLICATION_STATUS.(OR(<Incomplete,I>,<Complete,C>)).APPLICATION_STATUS.;


Academic_Period comes from an Oracle table and in my fex is using a define in order to truncate the number of characters displayed:

xACADEMIC_PERIOD /A10 = EDIT(ACADEMIC_PERIOD, '9999999999');

and then in the PRINT section:

xACADEMIC_PERIOD AS ACADEMIC_PERIOD


Academic_Period would contain '201340' for example. So if I select No from the list box, I should pick this record up because it ends with '0'.

Does it have to do with Webfocus misinterpreting the text value as a number? I tried adding quotes as was done on the RESIDENCY and that created a different error regarding the 'A1' in the SUBSTR, so I took out the surrounding quotes. The fex is being executed from html composer document.

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


WebFocus 7.7.03
Win7, all output
October 30, 2012, 08:19 PM
George Patton
You could try EDIT instead of SUBSTR ...

WHERE EDIT(xACADEMIC_PERIOD, '$$$$$$$$$9') EQ ...


It might be better to put the EDIT in a DEFINE first.

I was also thinking that the 5 and 0 in your list might be interpreted as numbers.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
October 31, 2012, 02:56 PM
sxschech
Hi George,

Thanks for your suggestion. I still couldn't get it to work, so ended up calling tech support. This is what they came up with:

WHERE EDIT(ACADEMIC_PERIOD, '$$$$$9') EQ &USF_ONLINE.QUOTEDSTRING;


Something about that even though the field was defined as 10 characters, the value only contained six characters, so it wasn't seeing the character that I needed due to it being in the sixth rather than 10th position. (Which was why I originally tried substr).


WebFocus 7.7.03
Win7, all output