Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Separating a field data Post Reply Post New Topic
Page  of 2 Next >>
Author Message
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Topic: Separating a field data
    Posted: 28 Feb 2012 at 9:43am
Hello again,
So I have a new question.  Lets say I have two table fields that look like this:

Forecast Date                  Forecast QTY
01/12/2012                        2000
01/20/2012                        1500
02/01/2012                         3000
03/04/2012                        1700

and I want to display it like this:

Jan 2012         Feb 2010           Mar 2012
1500                  3000                  1700

How do I go about splitting the date field and have only each months most recent qty display under the proper month??

I hope that this made sense
Thanks
Brandon
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 28 Feb 2012 at 11:50am
one way to do it is
first group on formula
totext(year(Forecast Date))+totext(month(Forecast Date))
then  create formulas for each month like
if totext(month(Forecast Date)) in date()to date() then Forecast QTY
place them into group header
then go to sorting expert ad a sort by Forecast QTY descending
suppress detail selections
IP IP Logged
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 29 Feb 2012 at 4:12am
Thanks for the update.  It that worked to a point.  It is showing all the numbers properly in the group header, now the only thing is that I need it all to show up on 1 line.  Right now the way it is set up it looks like this:
Jan 12      Feb 12     Mar 12
1500
                 3000
                                 1700

when I need it to look like this:
Jan 2012         Feb 2010           Mar 2012
1500                  3000                  1700

How can I use the same logic but only group by totext(year(Forecast Date)) and not have the totext(month(Forecast Date)) in it??  I believe that this would work but when I try and sort the date field ascending/descending for a specified year, the feb numbers show up as zero in the group header because in the field (after using the mentioned formulas) the number for Feb are surrounded by 0's.

Thanks
IP IP Logged
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 01 Mar 2012 at 8:42am
Can anyone help me with this??  I am getting angry at this report haha
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 01 Mar 2012 at 10:07am
try this
group on year
create 3 formulas like
if (Forecast Date) in date()to date() then maximum((Forecast Date),year)
then create 3 formulas like
if   (Forecast Date)=           "Jan 12 "(formula) then Forecast QTY
then  sort by Forecast Date     descending
IP IP Logged
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 01 Mar 2012 at 10:38am
Thanks for the reply.  This is giving me the same info as the update before when they info is all on different lines.  I will use just Feb as an example, here are the formulas that I used:
Grouped on totext(year(Forecast Date))
Feb1 formula: if ({forecast_audit.forecast-date}) in date(YEAR({?Forecast Date}), 02, 01) to date(YEAR({?Forecast Date}), 02, 28)
    then ({forecast_audit.forecast-date})
Feb2 formula:  if {forecast_audit.forecast-date} = {@Feb} then {forecast_audit.forecast-qty}

Does that look right to you??
Again, thanks for the help
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 01 Mar 2012 at 11:10am
Feb1 formula: if ({forecast_audit.forecast-date}) in date(YEAR({?Forecast Date}), 02, 01) to date(YEAR({?Forecast Date}), 02, 28)
    then ({forecast_audit.forecast-date})
Feb2 formula:  if {forecast_audit.forecast-date} = maximum({@Feb},YEAR({?Forecast Date}) then {forecast_audit.forecast-qty}
IP IP Logged
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 02 Mar 2012 at 6:20am
When I try that...I get an error message saying "A field is required here" and then it highlights the YEAR({?Forecast Date}) part of the formula...which is weird because it is a field haha...
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 02 Mar 2012 at 6:50am
instead of  YEAR({?Forecast Date}) use  the formula that u create for group by.
IP IP Logged
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 02 Mar 2012 at 7:59am
I get an error stating "This field cannot be used as a group condition field"

Again thanks for the help on this...I really appreciate it
IP IP Logged
Page  of 2 Next >>
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.