Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Sorting and Grouping

Status
Not open for further replies.

mdwg2020

Programmer
Feb 17, 2005
51
US
Hey guys,

Is there a way that I can programmatically change sorting and grouping while running a report in a VB.NET application?

Thanks,

Brooks
 
Set 1 parameter @SortBy

set formulas eg.

Sort1 = if @sortBy = 1 then
Field1 (could be date or Id)
else
Nothing

sort2 = if @sortBy = 2 then
Field2 (could be an Integer )
else
Nothing

set a group for each formula

the group will work only if there is a value




Mo
 
In your example, I understand creating the parameter value, that way I can change the value using my application. I'm not a Crystal Expert, so I don't quite understand the rest of the formula.

What exactly is Sort1 and Sort2 in your example? Is that something builtin, or do I have to establish it somehow? Last thing, does this handle grouping as well, or is this just an example of sorting?

Sorry for all the questions, but I appreciate all the help!
 
Sort1 and Sort2 are formulas which you need to create in Crystal Reports,

you need to add the IF statement and depending on the parameter value you will assign a field to each formula.

then you create a GROUP for each formula, if there is something in sort1 or sort2 then the grouping will work otherwise they will be ignored

last; you set the sorting from the group, and this will be based on the FIELD type used eg datetime, currency, text

hope it helps

Mo
 
I will attempt to do that Mo, and let you know what I get. It make take me a little while to figure out how to create the formulas!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top