alecken
2009-02-13 17:30:14 UTC
I'm looping an array of records (from a fixed length feed) and creating a
structure for each required field. Then for every loop, I'm passing this
structure to a function to check if certain required field in the structure's
element is left empty.
The structure should look something like this:
<cfloop from="1" to="#ArrayLen(MyFile)#" index="i">
<cfset aEachLine[i]=StructNew()>
<cfset aEachLine[i]["LastName"]="#Mid(MyFile[i],17,40)#">
<cfset aEachLine[i]["FirstName"]="#Mid(MyFile[i],57,20)#">
<cfset aEachLine[i]["Address"]="#Mid(MyFile[i],140,38)#">
<cfset aEachLine[i]["City"]="#Mid(MyFile[i],254,19)#">
<cfset aEachLine[i]["State"]="#Mid(MyFile[i],273,2)#">
<cfset aEachLine[i]["Country"]="#Mid(MyFile[i],284,4)#">
In this example I'm assuming that my structure is this short
<CFSET CheckStructValue=CheckThisStruc(aEachLine)>
</cfloop>
How do I check if any of those struct. value is empty?
structure for each required field. Then for every loop, I'm passing this
structure to a function to check if certain required field in the structure's
element is left empty.
The structure should look something like this:
<cfloop from="1" to="#ArrayLen(MyFile)#" index="i">
<cfset aEachLine[i]=StructNew()>
<cfset aEachLine[i]["LastName"]="#Mid(MyFile[i],17,40)#">
<cfset aEachLine[i]["FirstName"]="#Mid(MyFile[i],57,20)#">
<cfset aEachLine[i]["Address"]="#Mid(MyFile[i],140,38)#">
<cfset aEachLine[i]["City"]="#Mid(MyFile[i],254,19)#">
<cfset aEachLine[i]["State"]="#Mid(MyFile[i],273,2)#">
<cfset aEachLine[i]["Country"]="#Mid(MyFile[i],284,4)#">
In this example I'm assuming that my structure is this short
<CFSET CheckStructValue=CheckThisStruc(aEachLine)>
</cfloop>
How do I check if any of those struct. value is empty?