Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Sorting on a custom with multiple columns Post Reply Post New Topic
<< Prev Page  of 2
Author Message
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 21 Oct 2013 at 11:00am
I understand that the 2nd part is displaying correctly. Since the syntax and data type of the 1st part are the same as the second, as you said, it should work. So...to test the theory, display just the 1st part in a formula by itself. If it works, then we know that the IF part is broken. If it doesn't, then I am with you in being confused.

If the 1st part really is working, but is not NULL, then you would use the ELSE of the statement, but I am guessing that it has a null value which is why you created the IF in the first place.

So if we check each and every part of the formula that is not working separately, we SHOULD be able to find the part of the logic that is not working and correct it.

Alas, it can be a pain, and can be a lot of work, but it is the only way to 'see' what CR is seeing.

HTH
IP IP Logged
charlese
Newbie
Newbie


Joined: 21 Apr 2011
Online Status: Offline
Posts: 33
Quote charlese Replybullet Posted: 21 Oct 2013 at 11:06am
Ok I have created just a formula for the concatenation and that seems to be working... I get

26/04/2013 00:00:007,208,907.00

29/04/2013 00:00:007,212,353.00

29/04/2013 00:00:007,212,362.00

So it seems like somethign is wrong with the if statement !!!
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 21 Oct 2013 at 11:09am
so the last thing to do is to display the field {ListofProfDetailTime.PresTimekeeper1__TkprDate__Title1__SortString} in the details and see what it's value is.

of course if it null, you won't see anything, but you can of course build a formula like:
isnull({ListofProfDetailTime.PresTimekeeper1__TkprDate__Title1__SortString})

this will display true or false
you can also build a formula like:
"'" + totext({ListofProfDetailTime.PresTimekeeper1__TkprDate__Title1__SortString}) + "'"


all are just ways to see what the data really looks like
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 21 Oct 2013 at 11:09am
what happens if you place both of your concantenated 'functional' formula's onto the report at the same time?
Do they both display the correct info or did that chaneg your results?


Edited by DBlank - 21 Oct 2013 at 11:11am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 21 Oct 2013 at 11:11am
that's a good point...
I probably would have had both running, so I didn't to inquire.
IP IP Logged
charlese
Newbie
Newbie


Joined: 21 Apr 2011
Online Status: Offline
Posts: 33
Quote charlese Replybullet Posted: 21 Oct 2013 at 11:12am
I am so sorry I have discovered my mistake ... I was testing for the wrong sort string in the if statement !!! feel so stupid now!!! but thank you very much for your help.  This has really help me to find out ways to debug my report when I have problems.  Many Thanks again.
IP IP Logged
charlese
Newbie
Newbie


Joined: 21 Apr 2011
Online Status: Offline
Posts: 33
Quote charlese Replybullet Posted: 24 Oct 2013 at 12:16am
Hi,
 
I thought I cracked this puzzle but came across another obstacle.  I am trying to sort my report detail and I have created a custom sort formula for it as.  The business rule is if there is no sortstring I want to sort by work date and OrigTimeIndex else I want to sort by work date and sort string
 
If IsNull ({ListofProfDetailTime.SortString}) then
    toText({ListofProfDetailTime.WorkDate}) & ToText({ListofProfDetailTime.Timecard1__OrigTimeIndex})
else
    toText({ListofProfDetailTime.WorkDate}) & ToText({ListofProfDetailTime.SortString})
 
However when the report is displaying the order of the work date is wrong
 
I am getting something like
 
07/10/2013
08/09/2013
09/10/2013
10/10/2013
22/09/2013
 
it is not taking the month into consideration at all.  Month 09 is after 10. 
Can someone please help me to solve this.
 
Kind Regards
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 24 Oct 2013 at 4:47am
ahhh...sorting a string will do that.

What I would do is make 2 groups (instead of the 1), the first would be on the date (as a formula) and the second on the timeIndex (unless it is a time-in which case I would combine it in the first group...I am thinking that it is just a number)

for the first group would be the WorkDate, and then for the second you would have the formula but with just the Index or the sort string.

You can suppress the second group, but all of the records would then come out in the desired order.

HTH

ps, I am sure that there are other ways to accomplish this, this just seems the simplest/quickest/most straight-forward to me
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Oct 2013 at 5:35am
a second on lockwelle's approach of creating a nactual datetime field to do your sort on. That said you may run into problems in the conversion since you also have a 'sort' field you concantenating in.
if you stay with text use two formulas as lockwelle suggests butt one for sorting that uses a string in
YYYYMMDDtime
and the other that you already have for display
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 24 Oct 2013 at 5:40am
Since I never use a sort expression, just the grouping value, I was replacing the concatenation with the 2 groups, since a number and datetime don't play well together.

You can always display whatever value is desired...
IP IP Logged
<< Prev Page  of 2
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.