Focal Point
[Solved] MAINTAIN - selection condition

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

June 12, 2009, 05:38 PM
JL
[Solved] MAINTAIN - selection condition
Hi,

I have an edit box - ebFirstName - in a Maintain form which is linked to a variable - first_name - which is defined as:
compute first_name/a20;

There is a search button on the form which will retrieve the data from the data source where the corresponding first name field contains the value entered in ebFirstName. If ebFirstName is null, then I would like to retrieve all the data.

My code for the data retrieval is:
infer ... into StkSearchList;
stack clear StkSearchList;
reposition print_search_view;
for all next print_search_view.PRINT_SEARCH_VIEW.APPLICANT_KEY into StkSearchList
where print_search_view.PRINT_SEARCH_VIEW.FIRST_NAME_UPCASE CONTAINS TRIM(first_name)

However, when I try to add:
or TRIM(first_name) EQ ''

It fails with FOC03645 error - WHERE clause syntax: POLISH expressions not yet supported.

I have to perform similar checks on other input fields, such as, last_name, ssn, etc. in the same where selection condition. Thus, it would be great to avoid having to code:
IF variable EQ '' then select everything else select with condition

Any suggestions as to how to handle this?

Thanks!
JL

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


Year(s) of experience in WebFOCUS: 5+. Using WebFOCUS 7.7.03 on Windows platform with Oracle/SQL Server.
June 12, 2009, 07:14 PM
GamP
Two possible solutions that I can see:
1. Split it up in parts.
Load all the data from the database in memory, then do stack copy statements, possibly with the help of repeat loops.
2. The other solution is of course to write a table request that accepts the input fields and return the answer set filtered and all (EXEC tablereq FROM fields INTO stack). Depending on the size of your database table this may even be faster then having maintain do it.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
June 15, 2009, 09:16 AM
Maintain Wizard
JL
Please test this example. Instead of using the TRIM function, use an A0. An A0 is an unlimited alpha that is as long as it needs to be.

MAINTAIN FILE MOVIES
COMPUTE MTITLE/A0 = 'ROOF'
INFER MOVIECODE INTO STKSEARCHLIST;
STACK CLEAR STKSEARCHLIST;
REPOSITION MOVIECODE
FOR ALL NEXT MOVIECODE INTO STKSEARCHLIST
WHERE TITLE CONTAINS MTITLE
TYPE "NUM RECORDS = <END

This code brings back two records while this code:

MAINTAIN FILE MOVIES
COMPUTE MTITLE/A0 = ''
INFER MOVIECODE INTO STKSEARCHLIST;
STACK CLEAR STKSEARCHLIST;
REPOSITION MOVIECODE
FOR ALL NEXT MOVIECODE INTO STKSEARCHLIST
WHERE TITLE CONTAINS MTITLE
TYPE "NUM RECORDS = <END

Returns all 60. Give it a try.

Mark
June 18, 2009, 11:38 AM
JL
Thank you for the suggestions!

JL


Year(s) of experience in WebFOCUS: 5+. Using WebFOCUS 7.7.03 on Windows platform with Oracle/SQL Server.