As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I'm looking for the most efficient way to implement a dynamic where-clause , this method should also be able use CONTAINS (meaning i should be able to search on a partial string)
Peter Here's a simple example using the MOVIES file:
MAINTAIN FILE MOVIES COMPUTE VAL/A0 = 'ROOF'; REPOSITION MOVIECODE FOR ALL NEXT MOVIECODE INTO STK WHERE TITLE CONTAINS VAL; COMPUTE I/I2=1; REPEAT STK.FOCCOUNT TYPE stk(i).TITLE; COMPUTE I=I+1; ENDREPEAT END
Yields: FIDDLER ON THE ROOF CAT ON A HOT TIN ROOF
Here, I am hardcoding the value for VAL, but you can place the field on a form and a user can enter or select. You can also pass it in.
Notice that the format of VAL is A0. This is an unlimited alpha field. It is as big as the data. This way you don't have to worry about trailing blanks.
Mark
Posts: 663 | Location: New York | Registered: May 08, 2003
stack clear stksloc compute val/A0=ShwLocation.S_ClientName.text; compute val2/A0='IT'; reposition id for all next id into stksloc where (client_name contains val or client_name contains val2); compute i=1; repeat stksloc.foccount compute i=i+1; endrepeat
There are two ways to accomplish this. You will have to decide which one is better at your site. We will use UPCASE and LOWER to change the case of input values. We will have to test for both cases. If you need MIXED case, you can use LCWORD to get that as well.
The first technique loads ALL the records into a stack, and then uses STACK copy to get the ones you want.
Infer Moviecode into MOVSTK For all next moviecode into ALLSTK
STACK COPY FROM ALLSTK INTO MOVSTK WHERE (TITLE CONTAINS VAL1U) OR (TITLE CONTAINS VAL1L) OR (TITLE CONTAINS VAL2U) OR (TITLE CONTAINS VAL2L) END
The second techinque uses a different NEXT statement for each condition. It loads less records that the first technique, but hits the database 4 times:
Reposition Moviecode For all next moviecode into MOVSTK(Movstk.foccount+1) WHERE (TITLE CONTAINS VAL1U) Reposition Moviecode For all next moviecode into MOVSTK(Movstk.foccount+1) WHERE (TITLE CONTAINS VAL1L) Reposition Moviecode For all next moviecode into MOVSTK(Movstk.foccount+1) WHERE (TITLE CONTAINS VAL2U) Reposition Moviecode For all next moviecode into MOVSTK(Movstk.foccount+1) WHERE (TITLE CONTAINS VAL2L)
END
I hope this helps - Mark
Posts: 663 | Location: New York | Registered: May 08, 2003
There is no draw back to using EXEC. I am sorry that I didn't mention it. You can do that 1 of 2 ways as well. You can JUST pass the 4 parameters that you want or you can build the 4 WHERE clauses and send them.
Using TABLE to do retrieval is VERY efficient. If you run into any problems, just let me know.
Mark
Posts: 663 | Location: New York | Registered: May 08, 2003
I have been working with it , this weekend and it seems to work fine only drawback with all methods seems to be that with very large queries that the screen turns white (flashes)