ColdFusion Report Builder

I am trying to use CF Report Builder because the client needs a pretty nicely broken out PDF report.    If I could just get it to output the data, it is going to be VERY pretty.    The code in the current HTML report is

<CFIF isdate(primaryreviewerdate)>#val(datediff("d", PrimaryReviewerDate, now()))#<CFELSE>0</CFIF> Days

Open in new window


This is my translation.  

iif(isdate(query.PrimaryReviewerDate), DateDiff(d, query.PrimaryReviewerDate, getdate()), DE("0 Days"))

Open in new window


Getting the error:   If the expression is a string, ensure that it is within quotes. Error: iif(isdate(query.PrimaryReviewerDate), DateDiff(d, query.PrimaryReviewerDate, getdate()), DE("0 Days")) is not a valid ColdFusion expression.

Anyone have any ideas??
digitalwiseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pravin AsarPrincipal Systems EngineerCommented:
Look at the working example. I simulated the query data, using QueryNew.
<cfscript>
            query = QueryNew("ID,PrimaryReviewerDate","integer,varchar");
            tt = QueryAddRow(query, 1);
            tt = QuerySetCell(query, "ID", 1);
            tt = QuerySetCell(query, "PrimaryReviewerDate", "12/1/2014");
            value2=iif((isdefined ("query.PrimaryReviewerDate") && isdate(query.PrimaryReviewerDate)), DateDiff('d',query.PrimaryReviewerDate, Now()), "O days");            
            WriteOutput ("Diff is :" &  value2);
</cfscript>

What kind of data field is PrimaryReviewerDate in your query ?
0
Pravin AsarPrincipal Systems EngineerCommented:
I checked with Date field also. It should work

query = QueryNew("ID,PrimaryReviewerDate","integer,date");
            tt = QueryAddRow(query, 1);
            tt = QuerySetCell(query, "ID", 1);
            tt = QuerySetCell(query, "PrimaryReviewerDate", CreateDateTime(2014,9,24,12,1,0));
            value2=iif((isdefined ("query.PrimaryReviewerDate") && isdate(query.PrimaryReviewerDate)), DateDiff('d',query.PrimaryReviewerDate, Now()), DE("O days"));            
            WriteOutput ("Diff is :" &  value2);
0
digitalwiseAuthor Commented:
This is in CF Report Builder.   That doesn't work.  I get the same error.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Pravin AsarPrincipal Systems EngineerCommented:
try

value2=iif((isdefined ('query.PrimaryReviewerDate') && isdate(query.PrimaryReviewerDate)), DateDiff('d',query.PrimaryReviewerDate, Now()),'O days');
0
Pravin AsarPrincipal Systems EngineerCommented:
Single Quote in lieu of Double quote
0
Pravin AsarPrincipal Systems EngineerCommented:
Okay. I tried with CF Builder for CF 9

Following worked for me

iif (isDate(query.PrimaryReviewerDate) EQ true, DateDiff('d',query.PrimaryReviewerDate, Now()),DE("0 Days"))
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pravin AsarPrincipal Systems EngineerCommented:
thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.