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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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 ?
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);
digitalwiseAuthor Commented:
This is in CF Report Builder.   That doesn't work.  I get the same error.
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Pravin AsarPrincipal Systems EngineerCommented:
try

value2=iif((isdefined ('query.PrimaryReviewerDate') && isdate(query.PrimaryReviewerDate)), DateDiff('d',query.PrimaryReviewerDate, Now()),'O days');
Pravin AsarPrincipal Systems EngineerCommented:
Single Quote in lieu of Double quote
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"))

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.
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.