Link to home
Start Free TrialLog in
Avatar of Coast Line
Coast LineFlag for Canada

asked on

Appending query Data into array of Structure for a structure

I have a structure and that structure already has a data like this

http://prntscr.com/d49e6w

and now i have a query which i want to convert that query to append to this line_items structure

i have the following query:
<cfset st.line_items = []>

<cfloop from="1" to="#arrayLen(quest)#" index="i">
	<cfset st.line_items[i] = {}>
	<cfset st.line_items[i].item_id = itemid>
	<cfset st.line_items[i].name = name>
	<cfset st.line_items[i].rate = rate>
	<cfset st.line_items[1].description = "">
	<cfset st.line_items[i].quantity = quantity>
</cfloop>

Open in new window


<cfloop query="oldItems">
	<cfset st.line_items[i].item_id = oldItems.item_id>
	<cfset st.line_items[i].name = oldItems.item_name>
	<cfset st.line_items[i].rate = oldItems.item_rate>
	<cfset st.line_items[i].description = oldItems.item_description>
	<cfset st.line_items[i].quantity = oldItems.item_quantity>
</cfloop>

Open in new window


but this query is only appending the last record

any idea how can i fix it

so all i need is to append the bottom one to the upper one  added
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Coast Line

ASKER

wow dude, how could i miss it, so good arrayappend function
Comes in handy when position isn't important, you just want to add something to the end of the array :)