Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Create Date Parameter from formula result Post Reply Post New Topic
Author Message
Lady Gray
Newbie
Newbie


Joined: 20 Feb 2014
Online Status: Offline
Posts: 4
Quote Lady Gray Replybullet Topic: Create Date Parameter from formula result
    Posted: 21 Feb 2014 at 7:57am
I have a report where order lines DATE_DUE and QTY_DUE were fields in my report.  In our ERP system, you can omit the due date in an order line and add ship schedule lines  with due dates and quantities.  I was using a sub report added to the bottom of the main report to show all these ship schedule lines, regardless of the due date.  My main report had a parameter input field for the user to input a date, and order lines due on and prior to this date would appear. 
 
I wanted to merge the ship schecule lines with the main order lines and return both kinds of order lines merged with a date parameter.  I have the date due and quantity formulas (if, then, else) correct to return the correct date and quantities merged to show all open order lines.  When I tried to create a new paramater for Date Due, I can only pick from the field list of the linked tables, not the formula I now have in the report for DATE DUE. 
 
How can I create a date parameter for this report?
IP IP Logged
hello
Groupie
Groupie
Avatar

Joined: 05 Feb 2014
Online Status: Offline
Posts: 85
Quote hello Replybullet Posted: 21 Feb 2014 at 8:06am
So, you no longer want user input for the date, you want the formula field to do the calculation instead?

If that's the case, then remove the parameter field and in its place, drag your new formula field to the canvas.

Edited by hello - 21 Feb 2014 at 8:11am
IP IP Logged
Lady Gray
Newbie
Newbie


Joined: 20 Feb 2014
Online Status: Offline
Posts: 4
Quote Lady Gray Replybullet Posted: 21 Feb 2014 at 8:49am
I do want the user input for the date in order to limit the lines returned to show all lines due up to 5 days in the future.  Right now all open order lines show.
I had to remove the original parameter in order to begin to revise the report.
My formula date field brings in the due date for both order line types, and it is already wotking in the report.  I just don't know if a date paramater can be created, or if the logic is wrong in the total report design.


Edited by Lady Gray - 21 Feb 2014 at 8:52am
IP IP Logged
hello
Groupie
Groupie
Avatar

Joined: 05 Feb 2014
Online Status: Offline
Posts: 85
Quote hello Replybullet Posted: 21 Feb 2014 at 9:33am
I think I understand you...

But, you can't limit or suppress a whole record in a formula field, only in the Select Record formula area.

So, under Report - Select Expert - Record...create your formula there. You will see the parameter field represented as a ?{} after you click on the "new" tab and choose your {table.date} field and probably the "is less than" from the pull down options.



Edited by hello - 21 Feb 2014 at 9:59am
IP IP Logged
Lady Gray
Newbie
Newbie


Joined: 20 Feb 2014
Online Status: Offline
Posts: 4
Quote Lady Gray Replybullet Posted: 21 Feb 2014 at 5:38pm
Idon't understand what formula to create in Select Expert.  I have two separate date fields from two different tables.  (I am not a CR expert.) 
 
If I create a parameter using an actual promise date in the order line, I would get just those lines.  (As in my original report)  If create it using the ship schedule date, I only get those lines.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Feb 2014 at 4:31am

Do you mean you are trying to pass a parameter down to your sub report?

and you want to use the result of a formula field in the main report as your parameter value?
IP IP Logged
hello
Groupie
Groupie
Avatar

Joined: 05 Feb 2014
Online Status: Offline
Posts: 85
Quote hello Replybullet Posted: 24 Feb 2014 at 5:54am
Originally posted by Lady Gray

Idon't understand what formula to create in Select Expert.  I have two separate date fields from two different tables.  (I am not a CR expert.) 
 

If I create a parameter using an actual promise date in the order line, I would get just those lines.  (As in my original report)  If create it using the ship schedule date, I only get those lines.


Maybe I don't understand fully.

The reason I mentioned the Select Expert is because it is really the only way to bypass records so they are not processed (afaik). It works like a select statement in SQL.

You don't really have to create a formula in the Select Expert, it will create the formula for you. You just need to know what fields to compare and how to compare them. And, if you are still planning on allowing the user to choose the date to limit the report, you can use that user parameter as one of the fields in the Select Expert. All you need now is to decide what field from one of your tables to compare it to.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 24 Feb 2014 at 7:11am
Going back to the original post, the formula you created cannot be used as a parameter as the outcome, prior to reading any records is not deterministic.

It sounds like she needs both records, but only 5 days in the future, so it would seem that she would want a date parameter, which was there before she revised the report and logic in the record selection formula (since as hello said that is the place to limit records, and you only want the open records to 5 days in the future).

one would think something like:
if {already fulfilled} then
true
else
if {should be filled in the next 5 days logic} then
    true
else
    false

usually to get a different date than the parameter you would use a function ADDDATE, which would like: ADDDATE("d",5, {?DateParameter})...but you probably already knew that.

Hopefully this is clearer than mud.
IP IP Logged
Lady Gray
Newbie
Newbie


Joined: 20 Feb 2014
Online Status: Offline
Posts: 4
Quote Lady Gray Replybullet Posted: 24 Feb 2014 at 1:38pm
I actually solved my issue when I got to work today.  I read down the parameter help topics, and found one process where you can choose report menu at the top, (another step here that I forgot) and choose the formula field in the report from the drop down, and save it, and you have a date input that limits the returned lines based on the data in the formula column.  It worked immediately.
 
Thanks to everyone that replied.  I know I rambled in describing my issue.  I needed for anyone at work to run this report with whatever date in the future they choose.  Now when I get it on the menu, they can do so and I can delete the tacked on sub-report I had at the bottom. 

Edited by Lady Gray - 24 Feb 2014 at 2:04pm
IP IP Logged
hello
Groupie
Groupie
Avatar

Joined: 05 Feb 2014
Online Status: Offline
Posts: 85
Quote hello Replybullet Posted: 25 Feb 2014 at 3:10am
?
IP IP Logged
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.