Focal Point
[SOLVED] Need to get a unique row from a hold file.

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

May 03, 2018, 02:29 PM
TexasStingray
[SOLVED] Need to get a unique row from a hold file.
All,

I have a Guided Ad-Hoc application where the user choose what columns they want to sort the report by and what column they want to print on the report. The data structure is such that we go and get all the data and then only show the actual columns they have selected. If the user were to select all the columns every row would be unique. However if they do not then it looks like there are duplicate records. What I need is to be able to print a distinct row based on the columns they have selected. In a perfect world all I would have to do is
TABLE FILE ????
PRINT DISTINCT &USER_SELECTED_COLUMNS
END

Does anyone know how I could accomplish this?

WebFOCUS 8x
on a report

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




Scott

Use SUM not PRINT and a BY

TABLE FILE ????
SUM &USER_SELECTED_COLUMNS
BY &USER_SELECTED_COLUMNS NOPRINT
END



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
Close but that would only make the vary last column of the print by hidden all the others in the &USER_SELECTED_COLUMNS still be visible. So here is what works.

The print variable has all he columns surrounded by a single quote and have the AND in between each column.

The actual variable that contains all the columns to be printed is &RP_FN01S_Detail1
The actual variable that contains all the columns to be sorted is &RP_FN01B_Sort1

Here is the solution,

 
-SET &OUTLEN = &RP_FN01S_Detail1.LENGTH;
-SET &NEWBYS = STRREP(&RP_FN01S_Detail1.LENGTH, &RP_FN01S_Detail1.QUOTEDSTRING, 7, ''' AND ''', 6, ''' BY ''', &OUTLEN, 'A&OUTLEN.EVAL');
-RUN
TABLE FILE ????
BY  &RP_FN01B_Sort1
BY &NEWBYS 
....


Thanks for your help it pointed me in the right direction.




Scott

Good.

Do not forget to edit your first post to add [SOLVED] at the subject.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007