Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] STRREP results in no data

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] STRREP results in no data
 Login/Join
 
Member
posted
Hi there,

I'm new to FOCUS and IBI, so please bear with me.

I created a STRREP function to strip out the string ' OR ' and put in commas so that I could pass this parameter to a SQL statement. The function works most of the time. If I choose Select All, it results in the proper response, " 'M 2S', 'M 2N', '4W', 'ICU', 'NICU', 'SNICU' ". IF I choose 'NICU', it results in 'NICU'. However, if I choose either '4W' or 'ICU', the result of the function is blank.

I created a small .fex file to highlight the issue. When I select 4W or ICU, the variable dummy shows '4W' or 'ICU' respectively. dummy2 is blank.

APP PATH ABSTRACTING NURSING
-SET &dummy = &SpecialCare.(OR(,,<4W,4W>,,,)).MultiLocationPrompt.;
-SET &before =''' OR ''';
-SET &after =''', ''';
-* STRREP(inlength, instring, searchlength,searchstring, replength,repstring, outlength, outstring)
-SET &dummy2 = STRREP(&dummy.LENGTH,&dummy, &before.LENGTH,&before, &after.LENGTH,&after, &dummy.LENGTH,'A&dummy.LENGTH');
-SET &ECHO=ALL;
TABLE FILE WF$HOLD
PRINT
&dummy AS 'dummy'
&dummy2 AS 'dummy2'
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
END

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


thx/Mark

WebFOCUS 7.6.4
WF Client -> (RH Linux)
Rpts Srv -> (Windows)
Excel,HTML
 
Posts: 8 | Location: Colorado | Registered: March 24, 2009Report This Post
Expert
posted Hide Post
  
-SET &ECHO=ALL;
-SET &QT = '''';
-SET &VALUE  = &QT | ' OR ' | &QT;
-SET &DUMMY1 = &QT | 'ONE'  | &QT | ' OR ' | &QT | 'TWO' | &QT | ' OR ' | &QT | 'THREE' | &QT;
-* STRREP(inlength, instring, searchlength,searchstring, replength,repstring, outlength, outstring)
-SET &DUMMY2 = STRREP(&DUMMY1.LENGTH, &DUMMY1, 4, ' OR ', 1, ',', &DUMMY1.LENGTH, 'A&DUMMY1.LENGTH');
-SET &DUMMY3 = STRREP(&DUMMY2.LENGTH, &DUMMY2, 1, ''''  , 0, 'X', &DUMMY2.LENGTH, 'A&DUMMY2.LENGTH'); 
-TYPE &DUMMY1
-TYPE &DUMMY2
-TYPE &DUMMY3
-EXIT



Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
Tom,

I'm not sure if your example solves the problem. I think the auto-prompt causes a weird situation. If only one selection is made, the value of &dummy contains quotes. If the number of characters excluding the quotes is less than 4 (the number of characters in ' OR ') the STRREP function does not work.

The quickest solution might be to check the length of &dummy - if it's less than 4, most likely there's only one value, so don't use STRREP:

-SET &ECHO=ALL;

-SET &before = ''' OR ''';
-SET &after  = ''', ''';

-SET &dummy = &SpecialCare.(OR(<NICU,NICU>,<ICU,ICU>,<4W,4W>,<M 2S,M 2S>,<A,A>,<B,B>)).MultiLocationPrompt.;

-* STRREP(inlength, instring, searchlength, searchstring, replength, repstring, outlength, outstring)
-SET &dummy2 = IF &dummy.LENGTH LE 5 THEN &dummy ELSE 
-  STRREP(&dummy.LENGTH, &dummy, &before.LENGTH, &before, &after.LENGTH, &after, &dummy.LENGTH, 'A&dummy.LENGTH');

-? &dummy


(I hate auto-prompting)


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Francis,

You are absolutely correct. I did miss the 1st line that checks for that, then, I concatenate the OR to it:
  
-SET &DUMMY = IF &DUMMY OMITS ' OR ' THEN &DUMMY  | ' OR ' ELSE &DUMMY ;


This way, the STRREP always works...

I was JUST focused on removing the quotes and the OR...

Good Catch!!! (3) lol

P.S. I, too, have disdain for the AUTOPROMPTER!!!! (4)


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
Me, three. I just talked a user out of deploying an app with the auto-prompt screen.


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
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Expert
posted Hide Post
Obviously, we're all over 40! Roll Eyes

45??? (I am, been doing this(FOCUS) since '83) Razzer

My actual code in PROD:

  
-*************************************************************************************************
-IF &MAIN_SORT EQ ' ' GOTO SKIP_BYS;
-SET &MAIN_SORT = IF &MAIN_SORT OMITS ' OR ' THEN &MAIN_SORT | ' OR ' ELSE &MAIN_SORT;
-SET &SORT_LEN  = &MAIN_SORT.LENGTH;
-SET &KEY_SORT1 = STRREP(&SORT_LEN, &MAIN_SORT, 4, ' OR ', 1, ',', &SORT_LEN, 'A&SORT_LEN.EVAL');
-SET &KEY_SORT2 = STRREP(&SORT_LEN, &KEY_SORT1, 1, ''''  ,0,  'X', &SORT_LEN, 'A&SORT_LEN.EVAL');
-*************************************************************************************************


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Member
posted Hide Post
Thanks so much for all of your help! I really appreciate the quick responses! I incorporated your responses and it works great!

I had a few questions:
- What does this line of code do?
SET &KEY_SORT2 = STRREP(&SORT_LEN, &KEY_SORT1, 1, '''' ,0, 'X', &SORT_LEN, 'A&SORT_LEN.EVAL');

- Do you have any suggestions on how to build a SQL Report in Report Caster with multiple selections without using auto-prompter? I'm using that because I thought it was my only option for adding the data straight into the SQL statement

- For STRREP, is it always true that searchstring cannot be longer than the instring?

It is working wonderfully! Thank you!


thx/Mark

WebFOCUS 7.6.4
WF Client -> (RH Linux)
Rpts Srv -> (Windows)
Excel,HTML
 
Posts: 8 | Location: Colorado | Registered: March 24, 2009Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] STRREP results in no data

Copyright © 1996-2020 Information Builders