Focal Point
[SOLVED] Trouble with getting distinct value list with row counts

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4397070196

January 30, 2019, 10:18 AM
Sean Sweeney
[SOLVED] Trouble with getting distinct value list with row counts
Hi,

Trying to do a distinct on a table field to receive the distinct values then add a row counter to each, (to be used for iteration). I've tried a few different routes to do this but the latest through the UI is here:

TABLE FILE TMP
SUM
COMPUTE ROWCNT/I9 = LAST ROWCNT + 1;
PRINT
DST.GUID
END

This gives me a distinct list of GUIDs but only the first row has a ROWCNT. Thoughts?

Thanks!

This message has been edited. Last edited by: FP Mod Chuck,


Windows 8203 All output formats
January 30, 2019, 10:24 AM
Tony A
Sorting it by GUI will give you distinct values, so
TABLE FILE TMP
SUM COMPUTE ROWCNT/I9 = LAST ROWCNT + 1;
BY GUID
END


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
January 30, 2019, 10:54 AM
Frans
Or

TABLE FILE TMP
RANKED BY GUID
END


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
January 30, 2019, 11:02 AM
Sean Sweeney
Worked, thanks!


Windows 8203 All output formats
January 30, 2019, 11:23 AM
Sean Sweeney
Follow up: I went the ranked route.

W.r.t. the 'BY' route though, I thought 'BY' is used for sorting, why would it result in a distinct in this case?

Thanks!


Windows 8203 All output formats
January 30, 2019, 12:22 PM
Frans
BY is for sorting and grouping. So in this case the most important thing is to group on GUID.

For the database group by or distinct is the same thing in terms of results.


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.