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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
Amper Variables
 Login/Join
 
<RBC007>
posted
SAMPLE VALUES FOR REF with characters like dash, periods, etc as delimiter.

I just need to get REF without any variable after

In the table I have one field called REF and that will have the values like ANY of the single lines below, Im trying to achieve

Sale- NEW SALES (oc Jim Watzrs
Delivery Complete : May 15 2005 (oc Jim Watzrs
Sent Package - June 13 2005 (oc Max Wxlters
Network Mail list (oc Max Wxlters
Sale- NEW SALES (oc Max Wxlters
Sale- NEW SALES (oc Mike Wxlters
Sale- NEW SALES (oc Dave Wxlters
Sent Package - June 18 2005
Delivery Complete : June 21 2005
Sent Package - June 18 2005

while I'm displaying these values in report, I need to show as grouped and total times

Sale 69
Delivery Complete 7
Sent Package 5
Network Mail list 8

using:
T1VAL/A40=GETTOK(REF,40,1,'(',40,'A40');
T2VAL/A40=GETTOK(REF,40,1,':',40,'A40');
T3VAL/A40=GETTOK(REF,40,1,'+',40,'A40');
T4VAL/A40=GETTOK(REF,40,1,'-',40,'A40');
SHORT_REF/A99=
IF T1VAL NE REF THEN T1VAL ELSE
IF T2VAL NE REF THEN T2VAL ELSE
IF T3VAL NE REF THEN T3VAL ELSE
IF T4VAL NE REF THEN T3VAL ELSE
REF;

So I need it to check for "loop" for '(', ':', '-', '+' all the delimiter using OR, because it will hit the first '(' and not check for the second variable


Am i missing something here, what can I do?
Please help!!!
 
Report This Post
Guru
posted Hide Post
Question would the following work for you
COMPUTE TEST/A20 =
IF REF LIKE 'Sale-%' 
THEN 'Sales'
ELSE IF REF LIKE 'Delivery 
Complete :%' 
THEN 'Delivery Complete'
ELSE IF REF LIKE 
'Sent Package -%' 
THEN 'Sent Package
 ELSE IF REF LIKE 
'Network Mail list 
(' THEN 'Network Mail list'
 ELSE 'N/A';

This message has been edited. Last edited by: <Mabel>,
 
Posts: 406 | Location: Canada | Registered: May 31, 2004Report This Post
<RBC007>
posted
quote:
Originally posted by CurtisA:
[qb] Question would the following
work for you?
COMPUTE TEST/A20 =
IF REF LIKE 'Sale-%' THEN 'Sales'
 ELSE IF REF LIKE 'Delivery 
Complete :%' 
THEN 'Delivery Complete
ELSE IF REF LIKE 'Sent Package -%' 
THEN 'Sent Package'
ELSE IF REF LIKE 'Network Mail list 
(' THEN 'Network Mail list'
ELSE 'N/A';
[/qb]
Great suggestion however
my concerns are the list or
variables are too many, my
"else" would be a long list.

This message has been edited. Last edited by: <Mabel>,
 
Report This Post
Expert
posted Hide Post
RBC007
irstly, a bit of data analysis.
From your data the first character
to appear would be the hyphen and
the last would be the brace. The
brace doesn't appear
in the 'Delivery Complete' data
line etc.... Build up your
understanding of the data you are
trying to interpret.<br /><br />
Then adjust the defines to pull out
the required characters in the order
that they are likely to appear -
'-', ':', '+' and '
('.<br /><br />Then find the
position of the character in the
input string so that you can
determine which one appears first.
Finally, take a substring of the
input field up unto the first 'special' character appearance.
Have a go with this code.
Details taken exactly from
your example data -
CREATE FILE REFS
MODIFY FILE REFS<br />DATA
Sale- NEW SALES (oc Jim Watzrs,
Delivery Complete : 
May 15 2005 (oc Jim Watzrs,$
Sent Package - June 13 2005 
(oc Max Wxlters,$
>Network Mail list (oc Max Wxlters,$
Sale- NEW SALES (oc Max Wxlters,$
Sale- NEW SALES (oc Mike Wxlters,$
Sale- NEW SALES (oc Dave Wxlters,$
Sent Package - June 18 2005,$
Delivery Complete : June 21 2005,$
Sent Package - June 18 2005,$
>END<br />-RUN
DEFINE FILE REFS
T_POS1/I2 = POSIT(REF,50,'-',1,'I2');
T_POS2/I2 = POSIT(REF,50,':',1,'I2');
T_POS3/I2 = POSIT(REF,50,'+',1,'I2'
T_POS4/I2 = POSIT(REF,50,'(',1,'I2');
T_POS/I2  = IF T_POS1 NE 0 THEN 
T_POS1 ELSE 
IF T_POS2 NE 0 THEN T_POS2 ELSE
 IF T_POS3 NE 0 THEN T_POS3 ELSE
IF T_POS4 NE 0 THEN T_POS4 ELSE 0;
SHORT_REF/A40 = SUBSTV
(40,REF,1,T_POS,'A40');
/>END<br />TABLE FILE REFS
SUM CNT.SHORT_REF AS 'Count'
BY SHORT_REF AS 'Ref. Type'
ON TABLE NOTOTAL
ON TABLE SET PAGE-NUM OFF
ON TABLE SET HTMLCSS ON
ON TABLE SET PRINT ONLINE
ON TABLE SET STYLE *<br />
ENDSTYLE
<br />END<br />
CREATE FILE REFS
If anyone e
lse wants to try it then the
REFS.mas is a single segment,
single (A50) field FOCUS file.
The output recieved is -
Ref. Type Count <br />
Delivery
Complete :
2 <br />Network Mail list ( 1
Sale- 4 <br />Sent Package - 3
I prefer to use boolean logic in the
multiple IF statement (T_POS)
but then it sometimes makes it
hard for others to
follow.<br /><br />
Hope this helps? All cheques
gratefully
recieved Wink

This message has been edited. Last edited by: <Mabel>,
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
<RBC007>
posted
Thanks for all the advise and direction, it was awesome - a real time saver.

Thanks for sharing!!!!
 
Report This Post
<RBC007>
posted
quote:
Originally posted by Tony Alsford:<br />[qb] RBC007<br /><br />Firstly, a bit of data analysis. From your data the first character to appear would be the hyphen and the last would be the brace. The brace doesn't appear in the 'Delivery Complete' data line etc....
Build up your understanding of the data you are trying to interpret.<br /><br />Then adjust the defines to pull out the required characters in the order that they are likely to appear - '-', ':', '+' and '('.
Then find the position of the
character in the input string
so that you can determine which
one appears first.
Finally, take a substring of the
input field up unto the first
'special' character
appearance.
Have a go with this code. Details taken exactly from your example data
CREATE FILE REFS
MODIFY FILE REFS<br />DATA
ale- NEW SALES (oc Jim Watzrs,$
>Delivery Complete : May 15 2005 
(oc Jim Watzrs,$<br />Sent Package - J
une 13 2005 (oc Max Wxlters,$<br />Network Mail list (oc Max Wxlters,$
ale- NEW SALES (oc Max Wxlters,$
Sale- NEW SALES (oc Mike Wxlters,$
Sale- NEW SALES (oc Dave Wxlters,$
Sent Package - June 18 2005,$
Delivery Complete : June 21 2005,$
Sent Package - June 18 2005,$
END<br />-RUN<br />DEFINE FILE REFS
T_POS1/I2 = POSIT(REF,50,'-',1,'I2');
T_POS2/I2 = POSIT(REF,50,':',1,'I2')
T_POS3/I2 = POSIT(REF,50,'+',1,'I2')
T_POS4/I2 = POSIT(REF,50,'(',1,'I2');
T_POS/I2  = IF T_POS1 NE 0 THEN T_POS1 ELSE
IF T_POS2 NE 0 THEN T_POS2 ELSE
IF T_POS3 NE 0 THEN T_POS3 ELSE           
IF T_POS4 NE 0 THEN T_POS4 ELSE 0;
SHORT_REF/A40 = SUBSTV(40,REF,1,T_POS,'A40');
END
TABLE FILE REFS
SUM CNT.SHORT_REF AS 'Count'
BY SHORT_REF
 AS 'Ref. Type'
ON TABLE NOTOTAL
ON TABLE SET PAGE-NUM OFF
ON TABLE SET HTMLCSS ON
ON TABLE SET PRINT ONLINE
ON TABLE SET STYLE *<br />ENDSTYLE
END<br />CREATE FILE REFS
If anyone else wants to try
it then the REFS.mas is a single segment,
single
(A50) field FOCUS file.
The output recieved is -<br /><br />
Ref. Type Count <br />Delivery Complete :
2 <br />Network Mail list ( 1 <br />Sale- 4
<br />Sent Package - 3 <br /><br />
I prefer to use boolean logic in the
multiple IF statement (T_POS) but
then it sometimes makes it hard for o
thers to follow.<br /><br />Hope
this helps? All cheques gratefully
recieved Wink [/qb]
Tony
thanks for the time it must have took to (detail) document your advise.<br />.

This message has been edited. Last edited by: <Mabel>,
 
Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders