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     STRREP function and numbers

Read-Only Read-Only Topic
Go
Search
Notify
Tools
STRREP function and numbers
 Login/Join
 
Member
posted
We have a HTML page that allows a user to select mutiple selections of an AGENT value. Values are 0000, 0010, 0020, etc.. In the following example, the fex variable value for AGENT is '0000' OR '0010' or '0020' as expected for a multiple select listbox.

I'm trying to use STRREP to change the 0000 value of the string to TOT for heading display.

-SET &AGENT_LEN = &agent.LENGTH;
-SET &lagent = STRREP(&AGENT_LEN, &agent, 4, '0000', 3, 'TOT', &AGENT_LEN, 'A&AGENT_LEN.EVAL');

Translated: STRREP(26, '0000' OR '0010' OR '0020', 4, '0000', 3, 'TOT', 26, 'A26');

The problem seems to be the use of numbers in the searchstring paramter (4) of the STRREP function. Does anyone know what this issue is or how to replace the 0000 value to TOT.

I use the STRREP function regularly, but have never needed to replace numbers within a string just characters.

Thanks
David


wf: 7.6.4
App. and reporting server: UNIX/AIX 5.3
 
Posts: 20 | Registered: June 01, 2007Report This Post
Virtuoso
posted Hide Post
Ah, the joys of WebFOCUS.

Try:
-SET &AGENT_LEN = &agent.LENGTH;
-SET &lagent = STRREP(&AGENT_LEN, &agent, 4, '0000X', 3, 'TOT', &AGENT_LEN, 'A&AGENT_LEN.EVAL');

By keeping the search length at 4, but convincing the search string its alpha with an 'X', you should get what you want.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Member
posted Hide Post
Thanks Alan, that works perfect!!!!


wf: 7.6.4
App. and reporting server: UNIX/AIX 5.3
 
Posts: 20 | Registered: June 01, 2007Report This Post
Expert
posted Hide Post
FYI

You don't need to use a separate variable for the length, just use .LENGTH instead.
-SET &lagent = STRREP(&agent.LENGTH, &agent, 4, '0000X', 3, 'TOT', &agent.LENGTH, 'A&agent.LENGTH');


Thanks Tony for spotting the oversight. Unfortunately, there is no more haste at my age.

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


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
quote:
-SET &lagent = STRREP(&agent.LENGTH, &agent, 4, '0000X', 3, 'TOT', &AGENT_LEN, 'A&agent.LENGTH');

Warren,

In your haste to reply, you missed one Wink

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
fmi,

Beware of the case where your user will choose only '0000'! The function will not like to have &agent be 0000 because it will be a number and not a string.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Virtuoso
posted Hide Post
Danny

You are right if this were to come across as just 0000, but as this is being passed from a multi-select, it should always have single quotes around it, in which case it is viewed as an alpha field, as what the function sees is:
STRREP(06, '0000', 4, '0000Z', 3, 'TOT', 06, 'A06');
which is acceptable to it.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Member
posted Hide Post
Thanks to everyone, I saw that it didn't work with a single select and below is how I handle it.

-SET &lagent = IF &lagent EQ 0000 THEN TOT ELSE &lagent;

-IF &lagent.LENGTH LT 7 THEN GOTO A1;

-SET &AGENT_LEN = &lagent.LENGTH;
-SET &lagent = STRREP(&AGENT_LEN, &lagent, 4, '0000X', 3, 'TOT', &AGENT_LEN, 'A&AGENT_LEN.EVAL');

-A1


wf: 7.6.4
App. and reporting server: UNIX/AIX 5.3
 
Posts: 20 | Registered: June 01, 2007Report 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     STRREP function and numbers

Copyright © 1996-2020 Information Builders