cfengineers
01/12/2024, 9:29 PM<cffunction name="getarrayindexbyvalue" returntype="numeric">
<cfargument name="thisvalue" type="string" required="Yes">
<cfargument name="thisfieldarray" type="array" required="Yes">
<cfloop index="i" from="1" to="#ArrayLen(thisfieldarray)#">
<cfif thisfieldarray[i].value eq thisvalue>
<cfreturn i>
</cfif>
</cfloop>
<cfreturn -1>
</cffunction> (edited)
[4:29 PM] it called search.cfc
[4:30 PM] for some reason I cannot call this function within the same cfc it lives in
cfengineers [4:30 PM]
<td class="formlight nobottom">
<cfdump var="#arguments#" >
<select name="#targetField#" size="8" multiple class="texttiny">
<cfloop index="reportoption" list="#ardisplayFields#">
<cfif this.getarrayindexbyvalue(reportoption,aravailableFields) Gt 0>
<option value="#reportoption#">#aravailableFields[this.getarrayindexbyvalue(reportoption,aravailableFields)].text#</option>
</cfif>
</cfloop>
</select>
</td>
cfengineers [4:30 PM]
I have tried this. scopping
[4:30 PM] any ideas?
cfengineers [4:31 PM]
Variable GETARRAYINDEXBYVALUE is undefined.
The error occurred in D/pool/content/sandbox/ernie2/cms/vts/personalpreference/formpersonaldashbaordcontrol.cfm line 182
180 : <select name="casereportfieldsdisplay" size="8" multiple class="texttiny">
181 : <cfloop index="reportoption" list="#casereportfieldsdisplay#">
182 : <cfif getarrayindexbyvalue(reportoption,casefieldarray) Gt 0>
183 : <option value="#reportoption#">#casefieldarray[getarrayindexbyvalue(reportoption,casefieldarray)].text#</option>