Group by condition

Stimulsoft Reports.Flex discussion
dennislee
Posts: 14
Joined: Tue Apr 02, 2013 5:41 am

Group by condition

Post by dennislee »

Hi,

Is there any way to define groupheaderband with multiple conditions? Say, for instance, before generating a report, I can select from a drop down list to select the group by condition to have say by user; by department or by title. Then, if I select by user, the report will look like this:

John Smith (as GroupHeaderBand)
Name Title Dept Gender (as GroupHeaderBand)
John Smith Manager Finance Male (as DataBand)

Ann Jones (as GroupHeaderBand)
Name Title Dept Gender (as GroupHeaderBand)
Ann Jones Manager Finance Male (as DataBand)

If I select by Dept, then the report becomes:

Finance (as GroupHeaderBand)
Name Title Dept Gender (as GroupHeaderBand)
John Smith Manager Finance Male (as DataBand)
Ann Jones Manager Finance Male (as DataBand)

If I select by Title, then the report becomes:

Manager (as GroupHeaderBand)
Name Title Dept Gender (as GroupHeaderBand)
John Smith Manager Finance Male (as DataBand)
Ann Jones Manager Finance Male (as DataBand)

In other words, the report grouping is generated according to the user selection.

Thanks in advance for your advise.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Group by condition

Post by HighAley »

Hello.

It's possible to change Condition of the report in the events or create several Conditions and Enable what you need.

Thank you.
dennislee
Posts: 14
Joined: Tue Apr 02, 2013 5:41 am

Re: Group by condition

Post by dennislee »

Hi,
Can you explain how it can be done? Or direct me to any doc or video to show how to do it? Thanks.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Group by condition

Post by HighAley »

Hello.

Please, read the 1.3 Conditional Formatting section of the Stimulsoft User Manual.
Also you could watch the videos on our site: http://www.stimulsoft.com/en/videos?tag ... conditions

Thank you.
dennislee
Posts: 14
Joined: Tue Apr 02, 2013 5:41 am

Re: Group by condition

Post by dennislee »

Hi,

Can I set a variable, say varGroupBy as a GroupHeaderBand condition such that varGroupBy is passed from a Flex program? Taking the example above, varGroupBy can be a Dept or Title. Thanks.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Group by condition

Post by HighAley »

Hello.

It's possible to use more simple way. You could set the Condition of the StiGroupHeaderBand. Here is a sample sode:

Code: Select all

var gb: StiGroupHeaderBand = report.getComponentByName("GroubBand1") as StiGroupHeaderBand;
gb.condition.value = "{Employees.ID}";
Thank you.
dennislee
Posts: 14
Joined: Tue Apr 02, 2013 5:41 am

Re: Group by condition

Post by dennislee »

Hi,

Thanks for the code, it works fine. Now able to group by different StiGroupHeaderBand Condition based on what is passed from Flex. Like in the tutorial video of Creating Reports with Group, we can define a text component that is same as the condition (in the video, the expression is {Customers.ContactTitle}) such that can the group change, the Customers.ContactTitle for that group will be printed. In other words, each group will have a different Customers.ContactTitle content printed. To illustrate, it will be like this:

Manager
Name Title Gender
Robert Smith
dennislee
Posts: 14
Joined: Tue Apr 02, 2013 5:41 am

Re: Group by condition

Post by dennislee »

sorry, accidently submitted the reply before finishing the message, continue here

Manager
Name Title Gender
Robert Smith Manager Male

Clerk
Name Title Gender
Amy Jones Clerk Male

The question is how can I pass this {Customers.ContactTitle} from Flex. Please note that this {Customers.ContactTitle} is a variable, it may a different group by condition. I have tried to create a variable say flexCondition and I set the content in flex app but the result turned out to have the group header remain unchanged. The result is as follow:

Manager
Name Title Gender
Robert Smith Manager Male

Manager (expect to be Clerk but remain as Manager)
Name Title Gender
Amy Jones Clerk Male

Manager (expect to be Junior Clerk but remain as Manager)
Name Title Gender
Peter Jones Junior Clerk Male

Thanks.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Group by condition

Post by HighAley »

Hello.

You should do the same with the text component on the Group header:

Code: Select all

var txt: StiText = report.getComponentByName("Text1") as StiText;
txt.text.value = "{Employees.ID}";
Thank you.
yu_report
Posts: 2
Joined: Thu Apr 18, 2013 2:17 pm

Re: Group by condition

Post by yu_report »

Hi, Aleksey:

can I set condition = {Employees.Department},{Employees.Project} ?

in other words, I need to group by Employee Department and Project at the same time, in my case, I need to set multiple grouping level, at each level, I need to group by more than one fields.

please let me know if this is possible, I tried in code it does not give me error, but it does not produce correct groupping
Locked