Hello. I have a custom tag that I've written for report
display that goes through a object with a query and outputs it in a
table. There is a sub-tag that allows you to specify special output
for a specific column. Here is an example:
<cf_report-display
reportObject="#REQUEST.g_reportData#">
<cf_report-display-header-value tagMode="default"
useColName="true"
rowSpan="2"/>
<cf_report-display-data-value
columnNameList="exp_cnt">
<a href="...">{{exp_cnt}}</a>
</cf_report-display-data-value>
</cf_report-display>
This works wonderfully. The calling page does not look at the
query, so any calls to fields in the query can only occur inside
the tag, so I wrap these calls with {{ }} and use a regex to parse
out the code, and then use evaluate to run it. Works great.
The problem I'm having is if I want to do conditional logic
on a query field, such as:
<cfif exp_cnt GT 100>
I can't write a <cfif> because the calling page can't
process the fields and the <cfif> gets processed before it's
passed to the custom tag. I tried coding a iif() in a string and
using DE() and evaluate() in the tag, but that didn't work
correctly either, the if statement would run, but the code to run
in if the condition worked would not display right. Plus it made
for some very hard to read code.
So I am trying to write a custom if tag, that allows you to
specify the condition, and then in the tag body put the code to run
if the condition passes. I would like to have the same features as
the <cfif>, <cfelseif>, and <cfelse> tags:
<cf_delay-if condition="exp_cnt LT 100">
Option 1
<cf_delay-else-if condition="exp_cnt LT 200">
Option 2
</cf_delay-else-if>
<cf_delay-else>
Option 3
</cf_delay-else>
</cf_delay-if>
I can get this part to work too. My problems are:
1) I wanted to allow nested if's.
2) If I do nested Ifs, and I have the if tag associated with
my report tag, will it work? Do I have to associate the if tag with
my report tag to pass data between them?
3) I also wanted to see if I could write this with the same
syntax as <cfif>:
<cfif >
...
<cfelseif>
...
<cfelse>
...
</cfif>
This is just a wish, not a requirement, but it would be nice.
Thanks for the help
Tim