Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Dates Post Reply Post New Topic
Author Message
Not_again
Newbie
Newbie
Avatar

Joined: 03 Sep 2013
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote Not_again Replybullet Topic: Dates
     Posted: 02 Oct 2013 at 4:22am
I have a list of dated transactions with quantities.

What I am trying to do is create 12 columns one for each month of the year starting with the current month and rolling forward a further 11 months.

I think I need to identify current month, current month +1, current month +2 etc but how can I do this with a date format of 31/10/2013?

At the same time as identifying the month in each column I also need to evaluate to different scenarios.

Scenario 1: if {SorDetail.MWarehouse} in ["C1", "C2", "C3", "C5", "C7", "CA"] then {SorDetail.MBackOrderQty} else 0

Scenario 2: if {SorDetail.MWarehouse} = 'FG' then {SorDetail.MBackOrderQty} else 0

Currently I am evaluating the scenarios individually with a month in them:

if {SorDetail.MWarehouse} = 'FG' and {@Date to Month # SO} = 'Oct'
then {SorDetail.MBackOrderQty} else 0

Any help much appreciated.
Thanks
Many Thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Oct 2013 at 4:53am
you may just reconsider using a crosstab with columns set to your date field and the grouping set to per month.
you likely will need to alter the date field to use mm/dd/yyyy format first though.
IP IP Logged
Not_again
Newbie
Newbie
Avatar

Joined: 03 Sep 2013
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote Not_again Replybullet Posted: 02 Oct 2013 at 7:44am
Thanks DBlank,you are correct I now have issues with the dates on the column headers.

I am trying to combine two different date fields that are formatted YYYYMMDD hh:mm:ss.

Ideally I would like these dates formatted to MMYY and then listed in one column ie combine columns to read 1013, 1113, 1213, 0114, 0214 etc.

I think its a case that I have been messing around with this all day and I am just not getting it.

Any suggestions anyone??
Many Thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Oct 2013 at 8:06am

two options

1. convert the text field to a date field and do as i suggested before. The ct header can be set to look like anything you want including the MMYY format with ease.
2. just extract the YYMM fields from the text and do your grouping on that.
I prefer option one as it gives you a lot more flexibility in using the datefield type for select criteria and grouping and can be easily changed for display purposed into numerous formats.
 
here is one way toconvert your string to a date
date(mid(field,5,2) + '/' + mid(field,7,2)+'/'+left(field,4))
 
IP IP Logged
Not_again
Newbie
Newbie
Avatar

Joined: 03 Sep 2013
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote Not_again Replybullet Posted: 03 Oct 2013 at 5:39am
Thanks again, this is fun isn't it....

The three date fields I need to use are all in date format anyway so that makes it a bit easier.

However this also makes it more difficult because I need to group them.

Tried this:
{WipMaster.JobDeliveryDate}={SorDetail.MLineShipDate}={SorDetail.MLineReceiptDat}

But it doesn't like the third argument.

If I enter them individually in the cross tab as column headers it creates three separate columns one for each field.

Ideally what I would like to have is one October 13 which looks at all three date fields.

Perhaps I am being too complicated and trying to do too much with one formula. I don't think so though.

Thanks again.
Many Thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 Oct 2013 at 5:48am
did you join the tables? And if so on what field(s)?
What you are describing is more of a data set issue based on how you are joining the tables together.


Edited by DBlank - 03 Oct 2013 at 5:49am
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