how we right in cfscript <cfoutput query="q"&g...
# lucee
s
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
deleted original, intended to reply in thread. pretty sure it would be q.currentRow with for ( i in q ) { }
s
but i tried with q and all i am getting is true
m
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
hmm, checking
yes it worked, ii was using an assignment data so it was coming as true
w
"thanks"
👍 4