| Author |
Message |
FBJoint
Newbie
Joined: 10 May 2010
Online Status: Offline
Posts: 3
|

Topic: Dynamically change group sort at runtime Posted: 10 May 2010 at 2:15am |
|
Hi,
Some domain specific info. We have documents, which have certain info set on them, and they have child documents, which is in the same table. As it is now, the records are grouped by the object id of the main document, and inside the document group there is anouther group which holds the child documents of the main document (Hold steady.. :P).
What we need is to still have it grouped by the id of the main document (we have to still show the info of the main document, and the child documents grouped inside) but sorted based on a variable in the first group. Lets say variable x, OR y.
We tried to create a formula : if {?sort} = 'A' then {table.x} else if {?sort} = 'B' then {table.y} else {table.z} and applied this to the first group. But ofc this screws up the whole report because its not grouped by the main document anymore, and we get alot of mess ;)
Any tips? (Hope you understood)
Sincerly, Frank
|
IP Logged |
|
|
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 10 May 2010 at 3:32am |
...so add a group above this groups by the main document.
OR
group by the main document, and in the group, check 'Use a Formula as Group Sort Order'
HTH
|
IP Logged |
|
FBJoint
Newbie
Joined: 10 May 2010
Online Status: Offline
Posts: 3
|

Posted: 11 May 2010 at 12:15am |
Originally posted by lockwellegroup by the main document, and in the group, check 'Use a Formula as Group Sort Order' Could you give me an example of some kind of formula? This formula has to return a number?
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 11 May 2010 at 3:15am |
the formula can return (really I think of it as display) any value the you want, it just needs to be the same type for all parts. If you are using a set of if statements then the values all have to be the same type...say number or datetime or string, you cannot mix them.
your formula:
if {?sort} = 'A' then {table.x} else if {?sort} = 'B' then {table.y} else {table.z}
should be fine, since this how you want to sort the records inside of a group.
HTH
|
IP Logged |
|
FBJoint
Newbie
Joined: 10 May 2010
Online Status: Offline
Posts: 3
|

Posted: 14 May 2010 at 2:08am |
|
inside the "use formula as group sort" formula I dont get access to the report fields(only the parameters), and the formula has to return a number.
|
IP Logged |
|
sravanthip
Newbie
Joined: 03 Aug 2010
Online Status: Offline
Posts: 7
|

Posted: 03 Aug 2010 at 9:36pm |
|
Me too Have same problem.
nside the "use formula as group sort" formula I dont get access to the report fields(only the parameters), and the formula has to return a number.
Please tell me the solution
|
IP Logged |
|
sravanthip
Newbie
Joined: 03 Aug 2010
Online Status: Offline
Posts: 7
|

Posted: 03 Aug 2010 at 9:44pm |
|
and also I tried like this without table fields:
if {?sortorder}="a" then
crAscendingOrder
else if {?sortorder}="d" then
crDescendingOrder
here sortorder is a string parameter.But it doesn't showing in descending order.please tell me the solution
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 04 Aug 2010 at 3:32am |
|
I create a group and group on the formula, the only caveat is that the information has to be available at the start of the report, it cannot be a calculated result...it can be a concatenation.
|
IP Logged |
|
|
|