Copy link to clipboard
Copied
<cfcontent type="application/vnd.ms-excel">
<cfset count = 0>
<cfloop index="Add" from="1" to="1" step="1">
<cfset count = count + 1>
<cfset Number = 'Form.inj_#count#'>
<cfset num = #Number#>
<cfset tick = 'Form.tick_#count#'>
<cfset sk = #tick#>
<cfset Quality = 'Form.quality_#count#'>
<cfset qa = #Quality#>
<cfset description = 'Form.description_#count#'>
<cfset des = #description#>
<cfoutput>
<table border="1" width="100%">
<tr>
<td align="center">#count#</td>
<td align="center">#Evaluate('sk')#</td>
<td align="center">#Evaluate('qa')#</td>
<td align="center">#Evaluate('des')#</td>
</tr>
</table>
</cfoutput>
</cfloop>
Having very little idea what you are trying to do, that looks like a clasic case where array notation would be used.
<cfcontent type="application/vnd.ms-excel">...
<cfset count = 0>
<cfloop index="Add" from="1" to="1" step="1">
<cfset count = count + 1>
<cfoutput>
<table border="1" width="100%">
<tr>
<td align="center">#count#</td>
<td align="center">#Form["tick_" & count]#</td>
<td align="center">#Form["quality_" & count]#</td>
<td align="center">#Form["description_" & count]#</td>
</tr>
</table>
</cfoutput
Copy link to clipboard
Copied
Having very little idea what you are trying to do, that looks like a clasic case where array notation would be used.
<cfcontent type="application/vnd.ms-excel">
<cfset count = 0>
<cfloop index="Add" from="1" to="1" step="1">
<cfset count = count + 1>
<cfoutput>
<table border="1" width="100%">
<tr>
<td align="center">#count#</td>
<td align="center">#Form["tick_" & count]#</td>
<td align="center">#Form["quality_" & count]#</td>
<td align="center">#Form["description_" & count]#</td>
</tr>
</table>
</cfoutput>
</cfloop>
That is my best guess at translating your very confusing code.
Copy link to clipboard
Copied
now its giving this message
Element tick_1 is undefined in a Java object of type class coldfusion.filter.FormScope.
Copy link to clipboard
Copied
You don't tell us what the code generates, and why you think it's erroneous.
Time to do a lot of <cfdump>ing... You should never assume that you know what value a particular variable contains at any particular point. You must L{=)(=)K AND SEE.
Copy link to clipboard
Copied
Hi
the code dont generate error, It will output Form.quality_1 and look through it but not value of that variable..
Copy link to clipboard
Copied
Here are some of the things that I do...
Copy link to clipboard
Copied
Hi,
Try this:
<cfcontent type="application/vnd.ms-excel">
<cfset count = 0>
<cfloop index="Add" from="1" to="1" step="1">
<cfset count = count + 1>
<cfset ThisNumber = "">
<cfif StructKeyExists(Form, "Inj_" & Count)>
<cfset ThisNumber = Form["Inj_" & Count]>
</cfif>
<cfset ThisTick = "">
<cfif StructKeyExists(Form, "Tick_" & Count)>
<cfset ThisTick = Form["Tick_" & Count]>
</cfif>
<cfset ThisQuality = "">
<cfif StructKeyExists(Form, "Quality_" & Count)>
<cfset ThisQuality = Form["Quality_" & Count]>
</cfif>
<cfset ThisDescription = "">
<cfif StructKeyExists(Form, "Description_" & Count)>
<cfset ThisDescription = Form["Description_" & Count]>
</cfif>
<cfoutput>
<table border="1" width="100%">
<tr>
<td align="center">#count#</td>
<td align="center">#ThisTick#</td>
<td align="center">#ThisQuality#</td>
<td align="center">#ThisDescription#</td>
</tr>
</table>
</cfoutput>
</cfloop>
The error indicated that the tick_1 form variable wasn't there, so I'm guessing it was a checkbox. You just have to expect that and code around it by either checking for it's existence first (like I did above), or using CFParam to ensure it exists.
Swift