sangeeta bhat
sangeeta bhat

Reputation: 31

Adding the value at the end of the array within the loop

I have tried appending the value at the end of the array.

<cfset NL = CreateObject("java", "java.lang.System").getProperty("line.separator")>
<cfset MyList= listToArray(UpldRslt,NL,false,true)>

<cfloop from="2" to="#ArrayLen(MyList)#" index="i">
  <cftry>
    <cfoutput>
      <cfset FinalList = reMatch('(?:"(?:[^"]|"")*"|[^,]*)', MyList[i])>

      <cfset ResidentialIndicatorOverrideID = replace(FinalList[1], """", "", "ALL") >
      <cfset Address = replace(FinalList[2], """", "", "ALL") >
      <cfset City = replace(FinalList[3], """", "", "ALL") >
      <cfset State = replace(FinalList[4], """", "", "ALL") >
      <cfset Zipcode = replace(FinalList[5], """", "", "ALL") >
      <cfif IsNumeric(Zip) eq "NO">
        <cfset ErrorNote = "Please enter the numeric value for ZIP" >
        <cfset ErrorOccured= 1> 
      </cfif>
      <cfif ErrorOccured eq 1>
        <cfset ArrayAppend(Mylist[i],"#ErrorNote#","true")>
      </cfif>
</cfloop>

If i use <cfset ArrayAppend(Mylist,"#ErrorNote#","true")> it is appending the value

the o/p for above line is

test,2,3,4,5
6,2,3,7,8
Please enter the numeric value for ZIP

The o/p which i am expecting is

test,2,3,4,5,Please enter the numeric value for ZIP
6,2,3,7,8

Some mistake in Arrayappend. Please help me with this

Upvotes: 1

Views: 65

Answers (0)

Related Questions