Focal Point
Group By using a user selected variable

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

May 27, 2008, 05:55 PM
rv
Group By using a user selected variable
I am new to WebFOCUS so hopefully this is an easy one.

I want to design a set of reports where the user selects what field they want the report to Group on. So I want to present the users two sets of prompts - one they can use to filter the data and the other they can select the Group by field. Depending on what they pick the report will show data grouped by that field, sub totals, page breaks etc.

Am I right in assuming it can be done quite easily in WebFOCUS.

Thanks,
Raj
May 27, 2008, 06:15 PM
GinnyJakes
Raj,

It can be done using variables and Dialogue Manager. I'm not sure how easy it would be for a brand-new user. There should be an example program in one of the IBI demo directories that does exactly what you want. Just run the demos and all the links and see if something strikes you as similar to what you are wanting to do.

You might want to update your profile signature with the WebFOCUS products that you are using, the releases and the platforms.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
May 27, 2008, 06:24 PM
rv
Thanks Ginny!

I will have access to advanced WebFOCUS developers in the near future. I didn't want to promise a functionality to our stakeholders before verifying it first.
May 27, 2008, 06:34 PM
jodye
Hi Raj

Yes we do that all the time. You can create very complex and dynamic reports like that.

Here is a simple example to get you started.

Assume that GROUPBY is coming from a multiple select combobox...

-SET &GROUPBY='MODEL, COUNTRY';
-SET &GETMODEL=IF POSIT(&GROUPBY, &GROUPBY.LENGTH, 'MODEL', 5, 'I2') GT 0 THEN 'BY MODEL' ELSE '';
-SET &GETCOUNTRY=IF POSIT(&GROUPBY, &GROUPBY.LENGTH, 'COUNTRY', 7, 'I2') GT 0 THEN 'BY COUNTRY' ELSE '';

TABLE FILE CAR
SUM SALES
&GETMODEL
&GETCOUNTRY
END

-SET &GROUPBY='MODEL';
-SET &GETMODEL=IF POSIT(&GROUPBY, &GROUPBY.LENGTH, 'MODEL', 5, 'I2') GT 0 THEN 'BY MODEL' ELSE '';
-SET &GETCOUNTRY=IF POSIT(&GROUPBY, &GROUPBY.LENGTH, 'COUNTRY', 7, 'I2') GT 0 THEN 'BY COUNTRY' ELSE '';

TABLE FILE CAR
SUM SALES
&GETMODEL
&GETCOUNTRY
END

-SET &GROUPBY='COUNTRY';
-SET &GETMODEL=IF POSIT(&GROUPBY, &GROUPBY.LENGTH, 'MODEL', 5, 'I2') GT 0 THEN 'BY MODEL' ELSE '';
-SET &GETCOUNTRY=IF POSIT(&GROUPBY, &GROUPBY.LENGTH, 'COUNTRY', 7, 'I2') GT 0 THEN 'BY COUNTRY' ELSE '';

TABLE FILE CAR
SUM SALES
&GETMODEL
&GETCOUNTRY
END



Jodye


WF 8.0.0.5M
May 27, 2008, 07:10 PM
Darin Lee
Great example Jodye. I wouldn't even go that complicated. I just have simple drop-downs. I use multiple drop-down boxes if they want multiple sorts rather than a multi-select. It seems to work better when you also have drill-downs in the report. Anyway, this allows you to simply substitute and &var wherever the BY field would be used:

TABLE FILE CAR
PRINT CAR
BY &SORT1 PAGE-BREAK
ON &SORT1 SUBTOTAL
END


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat