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.
New TIBCO Community Coming Soon
In early summer, TIBCO plans to launch a new community—with a new user experience, enhanced search, and expanded capabilities for member engagement with answers and discussions! In advance of that, the current myibi community will be retired on April 30. We will continue to provide updates here on both the retirement of myibi and the new community launch.
What You Need to Know about Our New Community
We value the wealth of knowledge and engagement shared by community members and hope the new community will continue cultivating networking, knowledge sharing, and discussion.
During the transition period, from April 20th until the new community is launched this summer, myibi users should access the TIBCO WebFOCUS page to engage.
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
ChristianThis 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
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:
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
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
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.
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