Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem using result of formula in record selection

Status
Not open for further replies.

Parkaboy

MIS
Dec 2, 2002
22
US
Creatd report based on date of an action. Having trouble passing date to record selection (literal date) so I created a formula:
(will be adding parameters at a later date)

Shared datetimeVar dt :={Action.EnteredDate};
If dt = #2011-02-01# then
'T'
else
'F'

If the date is within the range returns true (as string)in the record selection. ( formula in record selection @testdate = 'T')

I continue to get the error message asking for a different format, and unable to get the record selection to work correctly.

I am working with a literal date, then testing for True or False,
but passing as string. Shouldn't this work ??

Thx
 
You should be able to enter the following directly in report->selection formula->record:

{Action.EnteredDate} = #2011-02-01#

I think the problem with your original formula is that you are setting it as a shared variable. Remove the "shared" and it should work, but I'm wondering why you would complicate it so.

-LB
 
I think this would work better:
Shared datetimeVar dt :={Action.EnteredDate};
If date(dt) = date(2011,02,01) then
'T'
else
'F'
 
After lbass's comment I re-read the post (running on about three hours sleep).

If date({Action.EnteredDate}) = date(2011,02,01) then
True
else
False

This should work better for record selection. Also I don't think you need the else, but it is a good coding practice. You also should be able to just put in the date({Action.EnteredDate}) = date(2011,02,01)right into the record selection formula section.

I hope this helps.
 

Thanks for the replys. Yes I was coding it correct, and all of the suggested solutions were helpful and led me to the real issue:

I could only succesfully pass the date if I did so under Group Selection Formula. If I try to pass the same selection formula for records, the report does not accept the date.

Which is odd, as there are NO Groups in this report.

I have "Perform Grouping on Server" turned off,
using a MSSQL database, and CR v.12.1 (CR 2008)
Driver = ODBC (RDO)

Thinking driver issue? Join?, or something simple ?


 
Did you remove the "shared"? I think you are overcomplicating this. Just use:

{Action.EnteredDate} = #2011-02-01#

...in selection formula->record.

-LB

 
If for some reason you feel the need to use the shared variable, why are you using dateTIMEvar? To me it sounds like your date is just a date without a time attached to it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top