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     How do I create a consecutive counter on a activity in WebFocus

Read-Only Read-Only Topic
Go
Search
Notify
Tools
How do I create a consecutive counter on a activity in WebFocus
 Login/Join
 
Silver Member
posted
Hi everyone, I am not knew to Webfocus but kind of new to this board. I do alot of lurking and have learn SO MUCH from you guys. But, I am stumped on how to create a consecutive counter for a given account activity.
For example I am looking to capture customers who had a consecutive charge to their account for a period of 4 days. The charge has to be 4 days consecutively. If there are two days where they didnt have a charge, but then on the third day they do; I want my counter to start over and now catpure the consecutive days. I know I have to create a define that sets a counter and that the counter has to start over when the pattern breaks, but for the life of me I cannot figure this out.

The data will look like this:

CustID Same ChargeNum Cnter day 1
CustID Same ChargeNum Cnter0 +1 day 2
CustID diff ChargeNum 0 day
CustID Same ChargeNum Cnter day 1
CustID Same ChargeNum Cnter0 +1 day 2
CustID Same ChargeNum Cnter0 +2 day 3
CustID Same ChargeNum Cnter0 +3 day 4

I cannot get my define to do the counter so I can say in my select statement Where conseccnt eq 4.

Define File Counter
Cnt/I5 = If customerid eq last customerid and chargenum eq last charge num then 1 else 0;
end

Can anyone help me with this one.
 
Posts: 45 | Location: North Carolina | Registered: February 17, 2005Report This Post
Virtuoso
posted Hide Post
I understand from your description that the records are already in customerid and Date order. I assume that Date has a smart-date usage (e.g., MDYY), and allow for multiple charges on the same Date. Try this:



DEFINE FILE Counter
Cnt/I5 =
-* first charge for this account? (reset counter)
IF (customerid NE LAST customerid) THEN 1
-* same acount and date?
ELSE IF (Date EQ LAST Date ) THEN Cnt
-* same account, next consecutive date?
ELSE IF (Date EQ LAST Date + 1) THEN Cnt + 1
-* same account, non-consecutive date (reset)
ELSE 1;
END
-* List all transactions of qualifying accounts:
TABLE FILE Counter
SUM MAX.Cnt NOPRINT
BY customerid
PRINT

BY customerid
BY Date
IF TOTAL MAX.Cnt GE 4
END

This message has been edited. Last edited by: <Mabel>,
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Silver Member
posted Hide Post
Yes, they are smartdates. A date is posted each time a charge is made to the account. I think this is EXACTLY what I need. Thanks!
 
Posts: 45 | Location: North Carolina | Registered: February 17, 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     How do I create a consecutive counter on a activity in WebFocus

Copyright © 1996-2020 Information Builders