I am doing through all the query functions and creating example to help me
learn and also to add as example to http://docs.lucee.org/
But am having issues with QueryMap()
As I read it http://docs.lucee.org/reference/functions/querymap.html, the
returned struct is used to populate the new query, but I am just getting
the original query
It would seem that you can only change the value of existing query fields
not:
- create a new query
- add a new column
Is this the case?
try {
qryPeople = queryNew(“name,dob”,“varchar,date”,[[“Susi”,
CreateDate(1970,1,1)],[“Urs”,CreateDate(1995,1,1)],[“Fred”,
CreateDate(1960,1,1)],[“Jim”, CreateDate(1988,1,1)]]);
// map dob to age
qryPeopleAge = qryPeople.map(function(row, rowNumber, qryData){
row[‘age’] = DateDiff(‘yyyy’, row.dob, Now());
dump(var=row, abort=false);
return row;
});
dump(var=qryPeopleAge, label=‘map() - map dob to age’);
} catch (any error) {
dump(var=error, abort=true);
}
–
AJ Mercer
<webonix:net strength=“Industrial” /> http://webonix.net | <webonix:org
community=“Open” /> http://webonix.org
http://twitter.com/webonix