http://coldfusion.com logo
#lucee
Title
# lucee
s

Simone

02/07/2022, 10:48 PM
how we right in cfscript <cfoutput query="q"> <cfset QueryAddRow(myqry, 1)> <cfset QuerySetCell(myqry, "a", "c", #q.CurrentRow#) /> <cfset QuerySetCell(myqry, "b", "d", #q.CurrentRow#) /> </cfoutput> i tried use for(i in q) but i.currentrow does not exists in this
m

Matt Jones

02/07/2022, 10:57 PM
deleted original, intended to reply in thread. pretty sure it would be q.currentRow with for ( i in q ) { }
s

Simone

02/07/2022, 10:57 PM
but i tried with q and all i am getting is true
m

Matt Jones

02/07/2022, 11:01 PM
for ( i in q ) { writeDump(q.currentRow); } // gives me 1 2 3 for a query with 3 rows
q = queryNew("name,type",
"varchar,varchar",
[ {name:"Apple",type:"Fruit"},
{name:"Orange",type:"Fruit"},
{name:"Chicken",type:"Meat"} ]);
myQ = queryNew("name,type",
"varchar,varchar",
[ {name:"Banana",type:"Fruit"},
{name:"Peach",type:"Fruit"},
{name:"Beef",type:"Meat"} ]);
for (  i in q ) {
myQ.AddRow({"name": i.name, "type": i.type});
}
writeDump(myQ);
my interpretation of what you are trying to do
if that is correct, but you really want to add row and set cell separately queryAddRow(myQ); querySetCell(myQ, "name", i.name, myQ.recordCount); querySetCell(myQ, "type", i.type, myQ.recordCount);
s

Simone

02/08/2022, 12:36 AM
hmm, checking
yes it worked, ii was using an assignment data so it was coming as true
w

websolete

02/08/2022, 2:07 PM
"thanks"
👍 4
6 Views