<cfif structheader

Hi ive the below piece of code, in which at the minute if PRINTPRICE exists in the csv file and is equal to “Y” is shows the prices otherwise they are hidden


<cfif structheader.PRINTPRICE eq "Y">
</cfif>

The above is working fine, but on older csv files it doesn’t have “PRINTPRICE” so if “PRINTPRICE” doesn’t exist I want it to display the prices by default

I was using the below piece of code but the prices are still been hidden on me
any one any tips on sorting this?
Thanks

<cfif isdefined ("structheader.PRINTPRICE")>
	 <cfif structheader.PRINTPRICE eq "Y" OR "">

I think you have to be more literal in the second part of the or statement.


<cfif structheader.PRINTPRICE eq "Y" OR structheader.PRINTPRICE eq "">

Alternatively, if PRINTPRICE is not defined you could use a negative NOT isDefined.


<cfif not isDefined('structheader.PRINTPRICE')>
  ...do default
<cfelseif structheader.PRINTPRICE EQ "Y">
  ...do something specific
<cfelse>
 ... do something else
</cfif>