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] How to Add and Restart Sequential Numbering

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] How to Add and Restart Sequential Numbering
 Login/Join
 
Platinum Member
posted
Hi all,
Please, I am seeking for an assistance on how I can sequentially number records by the number of payments per location. Below is what I am trying to achieve:
  
SN	Location	TYPE 	Desc	PAYMENT		OUTSTANDING 	PAYMENT_DT
1	A	TEST1	TESTA	110.25		111.50		DATE1
2	A	TEST1	TESTA	100.50		 11.00 		DATE2

1	B	TEST2	TESTB	210.25		211.50		DATE1
2	B	TEST2	TESTB	200.50		 11.00		DATE2
3	B	TEST2	TESTB	  6.00		  5.00		DATE3
 
1	C	TEST3	TESTC	10.00		 11.50		DATE1
2	C	TEST3	TESTC	10.00		  1.50		DATE2


Please, can someone help me with how I can add the SN column?

Thanks.

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7.7.02
Windows/SQL/CUBES
HTML/PDF/XLS
 
Posts: 117 | Registered: November 18, 2009Report This Post
Gold member
posted Hide Post
One solution:

TABLE FILE CAR
PRINT
DEALER_COST
RETAIL_COST
BY COUNTRY
BY CAR
BY MODEL

ON TABLE HOLD AS resultTab
END

DEFINE FILE resultTab
COUNTER /I10 = IF COUNTRY EQ LAST COUNTRY THEN COUNTER + 1 ELSE 1;
END
TABLE FILE resultTab
PRINT
DEALER_COST
RETAIL_COST

BY COUNTRY NOPRINT
BY COUNTER
BY COUNTRY
BY CAR
BY MODEL
END


WebFOCUS 7.6, 7.7
Windows, All Output formats
 
Posts: 90 | Location: Stuttgart | Registered: October 20, 2010Report This Post
Virtuoso
posted Hide Post
If the numbering depends on only the highest-order sort-field, try using the LIST verb:

TABLE FILE ...
LIST the-dependent-fields
BY highest-order-sort-field
BY additional-sort-fields
ON TABLE HOLD
END

The result will include a numeric datafield, LIST/I5, which meets your requirement.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
You can add the counter as a COMPUTE field so it will calculated in a single pass *after* sorting has taken place in the internal matrix:

TABLE FILE CAR
PRINT
COMPUTE SN/I11 = IF COUNTRY EQ LAST COUNTRY THEN SN + 1 ELSE 1;
        COUNTRY
        CAR
        MODEL
        DEALER_COST
        RETAIL_COST
BY COUNTRY NOPRINT
END


That will work fine for both FOCUS and non-FOCUS sources (e.g. database tables)

If you have to reset your counter based on more than 1 "key field", say, COUNTRY and CAR, just change your condition slightly:

...
COMPUTE SN/I11 = IF COUNTRY EQ LAST COUNTRY AND CAR EQ LAST CAR THEN SN + 1 ELSE 1;
...



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
Thank you.


WebFOCUS 7.7.02
Windows/SQL/CUBES
HTML/PDF/XLS
 
Posts: 117 | Registered: November 18, 2009Report 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] How to Add and Restart Sequential Numbering

Copyright © 1996-2020 Information Builders