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 function error

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] strrep function error
 Login/Join
 
Gold member
posted
--SET &INSTRLEN=&SSN.LENGTH;
-SET &OR=''' OR ''';
-SET &WHERE= IF &INSTRLEN LE 09 THEN &SSN
- ELSE STRREP(&INSTRLEN, &INSTR,1,',',6, &OR, 200, 'A200') || ''''';

IF I assign the ssn to be 123456789 ,for example, I get this (FOC36355) INVALID TYPE OF ARGUMENT #2 FOR USER FUNCTION STRREP. How can I fix this?
Thanks so much in advance,
KK

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


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report This Post
Expert
posted Hide Post
Since the error you get points to the second argument of STRREP and you haven't provided an example value for it (&INSTR), we can't be of much help.

Please provide an example value of &INSTR.


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
Gold member
posted Hide Post
-SET &INSTRLEN=&SSN.LENGTH;
-SET &OR=''' OR ''';
-SET &WHERE= IF &INSTRLEN LE 09 THEN &SSN
- ELSE STRREP(&INSTRLEN, &SSN,1,',',6, &OR, 200, 'A200') || ''''';

Sorry. it should be &ssn. What this function trying to do is that when the user enters more than 1 ssn in a text box, s/he will be using comma(,) to seperate them and I am trying to have it removed and replaced with an OR with open single and close quotes around them.


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report This Post
Master
posted Hide Post
quote:
STRREP(&INSTRLEN, &INSTR | ' ',1,',',6, &OR, 200, 'A200') || ''''';


In DM function calls where an Alpha type is required always concat a blank to force it to alpha type. ASIS is meant to do this as well but does not work.

In your example dm takes string '123456789' and converts it to a double precision value despite the single quotes.

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



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
Master
posted Hide Post
CAN WE PLEASE HAVE SOMETHING ABOUT THIS IN THE MANUAL SOMETIME PLEASE OR EVEN A CHECKER IN DS.

SO MANY PEOPLE END UP WASTING ABOUT HALF A DAY OVER THIS MATTER. ABOUT 10 YEARS AGO I HAD A SIMILAR PROB WITH CHKFMT AND I SOLVED IT, BUT WHILE I WAS LOOKING FOR THE SOLUTION, I FELT LIKE GOING OUT AND JOINING JOHN RAMBO AT THE OUTSKIRTS OF SOCIETY.



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
Gold member
posted Hide Post
Thanks so much. It worked now. Hammo1j is correct. I am sure alot of people that are not at the guru level like me may even spend more than half a day trying to look at the function to debug.
Thanks so much.


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report This Post
Expert
posted Hide Post
The clue is in the function that you are trying to use. STRREP is for replacing one part of a string with another string.

So when you try and pass in a value of 123456789, it is treated as a numeric value not an alphanumeric string. Enclose the 123456789 in singles quotes and you should be on your way.

T

John,

You're out of place complaining about the "documentation", that is Francis' lifetime commitment Wink



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
Guru
posted Hide Post
Hi

Can anyone tell me what is wrong here? I want to strip the '/' if there is one.

-DEFAULT &FROMDATE = '04/20/10'
-DEFAULT &TODATE = '042110'
-SET &ECHO = ALL;
-TYPE &FROMDATE  &TODATE;
-SET &FROMDATE = STRREP(&FROMDATE.LENGTH, '&FROMDATE', 1, '/', 0,'X', 8, &FROMDATE);
-SET &TODATE = STRREP(&TODATE.LENGTH, '&TODATE', 1, '/', 0,'X', 8, &TODATE);
-TYPE &FROMDATE  &TODATE;
-EXIT  


-TYPE 04/20/10  042110;
 04/20/10  042110;
 -SET &FROMDATE = STRREP(08, '04/20/10', 1, '/', 0,'X', 8, 04/20/10);
 -SET &TODATE = STRREP(06, '042110', 1, '/', 0,'X', 8, 042110);
 -TYPE &FROMDAT  &TODAT;
 &FROMDAT  &TODAT;
 -EXIT
  


Thanks.

Hua


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
 
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008Report This Post
Virtuoso
posted Hide Post
Try this:

-DEFAULT &FROMDATE = '04/20/10'
-DEFAULT &TODATE  = '042110'
-SET &ECHO = ALL;
-TYPE &FROMDATE  &TODATE
-SET &FROMDATE = STRREP(&FROMDATE.LENGTH, &FROMDATE.QUOTEDSTRING | '', 1, '/', 0,'X', &FROMDATE.LENGTH, 'A&FROMDATE.LENGTH');
-SET &TODATE   = STRREP(&TODATE.LENGTH, &TODATE.QUOTEDSTRING | '', 1, '/', 0,'X', &FROMDATE.LENGTH, 'A&TODATE.LENGTH');
-TYPE &FROMDATE  &TODATE


- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
quote:
&TODATE.QUOTEDSTRING | ''


This is to force DM to "see" the value in &TODATE as a string and not to interpret it as a number.

Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
quote:
&FROMDATE.QUOTEDSTRING | ''


Of course, the same should be applicable to &FROMDATE as well. I've edited the code I had posted to reflect that change.

Hope that helps!

- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Guru
posted Hide Post
Thank you, Neftali.

A&FROMDATE.LENGTH is the key. While I was playing with the 2nd arguement to ensure its value as string, the results are inconsistent without the last one as alpha format.


Hua


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
 
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008Report This Post
Virtuoso
posted Hide Post
You're welcome Hua. I'm glad it worked. Would you mind closing this topic?

Best,
Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report 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 function error

Copyright © 1996-2020 Information Builders