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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula error and Suppress blank section help 2

Status
Not open for further replies.

cyreports

Programmer
May 12, 2010
89
US
I have two issues in my report I hope to resolve. I think when I fix the formula, the suppress will work.

I created a report titled: Date

@Date is set up as follows:

Code:
if {?SUMMARY} = true then 
"" else 
{ado.Date}

I am getting this error:

"A String is required here" and it highlights the {ado.Date} field. I can change it to ToText({ado.Date}) but thats not correct I think.

In my report, I am grouping 3 levels.

Group 1 - {Data. @Date}
Group 2 - {Data.Facility}
Group 3 - {Data.Resource}

My intent is to group on @Date and when the end user selects a specific action the Group 1 header and footer would suppress and not group the Group 1 header and footer. I would do this by making sure the "suppress blank sections" was checked on the group 1 header and footer.

 
I'd do it as
Code:
if {?SUMMARY} 
then "" 
else ToText({ado.Date}, "ddMMyy")
Assuming {?SUMMARY} is a boolian, it can be tested directly rather than = true, though both methods work. But there is indeed an incompatability between a string and a date, Crystal usually holds dates in some special format. I can't see why you backed away from that answer, which was correct.

Hope this helps. If there is more, please explain.



[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 


All blocks of an if..then statement must return the same datatype, so you had the right idea when you tried to change the date field to text.

But you need to group by the ado.date field, so both parts need to return a date. If the user selects Summary, you want all of group 1 to be together, so this would work:

if {?Summary} = false then ado.date
else currentdate

Now if the user selects true group 1 will group together on today's date, which only works because you're going to suppress the GH and GF anyway, which essentially makes group 1 go away.

 
Your formula should probably be:

if {?SUMMARY} = true then
"" else
totext({ado.Date},"yyyy/MM/dd")

This will allow you to NOT group on date for a summary report, and will allow the dates when used, to appear in correct order. And yes, you would format the group header/footer sections to "suppress blank section".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top