Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Sort field Statement Post Reply Post New Topic
Author Message
Grifter
Newbie
Newbie


Joined: 02 Jun 2009
Online Status: Offline
Posts: 32
Quote Grifter Replybullet Topic: Sort field Statement
     Posted: 02 Jun 2009 at 7:55am
Hi

I have just joined as I am using CR 9 now in my work and have never used it before.

I am currently updating an existing report that when the users run it they can pick certain parameters to sort the data by.

I went into Formula Fields > Sort > Edit, and found this statement:

select {?@SortField}
case "Parameter Name" : {view.Column}
case "Parameter Name" : totext ({view.column})
case "Parameter Name" : {view.column}

These are the three parameters that can currently be used to sort. I have added a few more and need to change this statement to make them actually work.

The problem is one of my sorts requires multiple columns and I can't figure out the syntax to do it in this statement.

In a normal query you would do this:

Select ....
From....
Order by x, y

But I can't do this in this statement. Have tried different things and just get errors.

I appreciate any guidance on this issue.

Thanks
 
G


IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 02 Jun 2009 at 8:37am

The trick will be to add the fields together.  To do this, they all have to be of the same type.  Since it looks like the result of this formula is a string, they'll all have to be converted to string.  This can get tricky if any of your fields is a date, because the 'MM/dd/yyyy' won't sort correctly - you have to format it as 'yyyyMMdd'.

So you'll add a line that looks something like this:

case "Parameter Name" : {view.column1} & {view.column2}&ToText({view.datecolumn}, 'yyyyMMdd')

-Dell
IP IP Logged
Grifter
Newbie
Newbie


Joined: 02 Jun 2009
Online Status: Offline
Posts: 32
Quote Grifter Replybullet Posted: 02 Jun 2009 at 8:40am
Ok thanks hilfy i'll see what I can do with that.


Thanks

G


Edited by Grifter - 02 Jun 2009 at 8:41am
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum