Hello,
In v4.5 QUERY BY FORMULA was implemented internally and allowed you to
use Active4D variables and methods in the expression. In v5 QUERY BY
FORMULA is now executed within 4D's context, which means it will
execute on the server at full speed.
For those who have existing code that used QUERY BY FORMULA with
Active4D variables and/or methods, I have written the equivalent of
the v4.5 version as a library method:
http://gist.github.com/248341
Add that method to a4d.utils, it will be included in the next release.
You can then change your QUERY BY FORMULA calls if necessary to
a4d.utils.queryByFormula. The first parameter has to change to a
pointer to the table, and the expression has to be made into a string.
If you need to reference local variables, you have to put them in a
collection and pass that as the third parameter.
So this:
$maxLength := 7
QUERY BY FORMULA([mytable]; length([mytable]name) <= $maxLength)
becomes this:
$c := new collection("maxLength"; 7)
a4d.utils.queryByFormula(->[mytable]; "length([mytable]name) <=
$context{\"maxLength\"}"; $c)
Note that within the expression, you always refer to the passed
collection as $context.
Kind regards,
Aparajita
www.aparajitaworld.com
"If you dare to fail, you are bound to succeed."
- Sri Chinmoy | www.srichinmoy.org
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/