Answered
Processing a list
I have a column, let's call it "BGT_CDS", in a database that
stores values as such:
row 1 -- "RING","AFFAIRS"
row 2 -- "MEMBER","TREASURER"
row 3 -- "VP, FINANCE"
I need to write these rows to a different table, but when I use the following code:
<cfloop from="1" to="#listLen(valueList(getData.BGT_CDS))#" index="i">
INSERT INTO comm_ACGI (BGT_CD)
VALUES
('#replace(listGetAt(valueList(getData.BGT_CDS),i),"""","","ALL")#')
</cfloop>
It comes back with this error:
Invalid list index 2.
In function ListGetAt(list, index [, delimiters]), the value of index, 2, is not a valid as the first argument (this list has 1 elements). Valid indexes are in the range 1 through the number of elements in the list.
The problem is that it thinks "VP, FINANCE" is two values when in fact it's one (the quotes are used to seperate each element). Can someone please shed some light?
TIA
row 1 -- "RING","AFFAIRS"
row 2 -- "MEMBER","TREASURER"
row 3 -- "VP, FINANCE"
I need to write these rows to a different table, but when I use the following code:
<cfloop from="1" to="#listLen(valueList(getData.BGT_CDS))#" index="i">
INSERT INTO comm_ACGI (BGT_CD)
VALUES
('#replace(listGetAt(valueList(getData.BGT_CDS),i),"""","","ALL")#')
</cfloop>
It comes back with this error:
Invalid list index 2.
In function ListGetAt(list, index [, delimiters]), the value of index, 2, is not a valid as the first argument (this list has 1 elements). Valid indexes are in the range 1 through the number of elements in the list.
The problem is that it thinks "VP, FINANCE" is two values when in fact it's one (the quotes are used to seperate each element). Can someone please shed some light?
TIA
