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] RIGHT Command in FOCUS

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] RIGHT Command in FOCUS
 Login/Join
 
Platinum Member
posted
Hi,

i know this is beginners stuff!! I need from a string the last six digits. I know how to do it when the string lenght is fix but the lenght is not fix.
Regards

Christian

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


WF Production Version: 7.7.02M
WF Test Version: 7.7.02M
Developer Studio: 7.7.02
HTML, EXL2K, FLEX, PDF,PPT
 
Posts: 156 | Location: Essen Germany | Registered: December 02, 2010Report This Post
Platinum Member
posted Hide Post
Hi Christian there is a previous topic on this subject that may be of use....
http://forums.informationbuild...7006316&f=7971057331


_______________________
*** WebFOCUS 8.1.05M ***
 
Posts: 196 | Location: London, UK | Registered: December 06, 2005Report This Post
Silver Member
posted Hide Post
Hi Christian,

Try using below functions

REVERSE and SUBSTR and again REVERSE.

I'm not sure if there are any other solutions.

You can take a look at character functions document on information builders.


WebFOCUS 8.1.03
Windows, Linux All Outputs
 
Posts: 46 | Location: India | Registered: August 18, 2011Report This Post
Virtuoso
posted Hide Post
You can attempt using SUBSTR with the support of ARGLEN to determine how long your string actually is.

-SET &MAX_LEN = 6;

DEFINE FILE CAR
CAR_LEN/I4 = ARGLEN(20, CAR, CAR_LEN);
CAR_LAST_SIX/A6 = SUBSTR(CAR_LEN, CAR, MAX(1, CAR_LEN - &MAX_LEN + 1), CAR_LEN, MIN(CAR_LEN, &MAX_LEN), CAR_LAST_SIX);
END

TABLE FILE CAR
PRINT CAR AND CAR_LEN AND CAR_LAST_SIX
END


My sample code is a bit elaborate as I need to account for cases when the string actually has less than 6 characters. If you know for sure that your string will always have 6 or more characters, you can simplify the expression to just:

CAR_LAST_SIX/A6 = SUBSTR(CAR_LEN, CAR, CAR_LEN - &MAX_LEN + 1, CAR_LEN, &MAX_LEN, CAR_LAST_SIX);



Hope that helps.



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
Try setting you max legth to the length of your input field and then use that in your process
-SET &MAX_LEN = &INPUT.LENGTH ;
DEFINE FILE CAR
HOW_LONG/I5=ARGLEN (15, CAR, HOW_LONG);
CAR_LAST_SIX/A&INPUT.LENGTH = SUBSTR(HOW_LONG, CAR, MAX(1, HOW_LONG - &MAX_LEN + 1), HOW_LONG, MIN(HOW_LONG, &MAX_LEN), CAR_LAST_SIX);
END


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Virtuoso
posted Hide Post
quote:
Try setting you max legth to the length of your input field


The purpose of &MAX_LEN in my code is not to determine the length of the field but actually the length of the substring he wants to create.

In his request, ChristianP says that he wants the last 6 characters, so instead of hard-coding it I simply set a variable with that value which can be adjusted when business rules change. Perhaps the variable name was a bit misleading so point well taken Wink

The .LENGTH approach is only feasible when dealing with Dialogue Manager variable but not with actual fields fetched from a database table or any other source which is the assumption I made in my example.



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
Platinum Member
posted Hide Post
Thanks everybody!!! As a german proverb says: "many roads lead to rome"

Regards

Christian


WF Production Version: 7.7.02M
WF Test Version: 7.7.02M
Developer Studio: 7.7.02
HTML, EXL2K, FLEX, PDF,PPT
 
Posts: 156 | Location: Essen Germany | Registered: December 02, 2010Report This Post
Guru
posted Hide Post
njsden,

I actually used this variation of your code to search a variable length data base field for an input field that was variable in length, so thanks for the tip I really appreciate it.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report 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] RIGHT Command in FOCUS

Copyright © 1996-2020 Information Builders