Is there currently (as of 17r6) a way to do an ORDA queryByFormula? (similar to the new OrderByFormulal)
You know the basic collection.query() or ds.TABLE.query() offer everything QBF does for me. What kinds of things are you thinking of?
So far, my question is theoretical.
However, If I make a Formula object, for code consistency, I’d like to be able to use it for both Ordering and querying.
I’m sure I’ll think of specific application in the future where QueryByFormula would have uses.
I see. I think I would do that by having a separate method for query and ordering. They could each take the same parameters but the two are different operations. And you could put both of them in the same object.
I make such objects sometimes like:
$obj.table:="My_Table" $obj.query:=Formula(z_generic_query($1)) $obj.orderBy:=Formula(z_generic_orderBy($1)) $0:=$obj
The z_generic_query method could look something like:
$queryStr:=< analyze the params in $1 > $temp_sel:=ds[This.table].query($queryStr) $0:=$temp_sel
Since z_generic_query runs in the context of the object formula you can use This to access anything stored in that object.
Just offering some ideas here. This is all really new stuff. I know I’m still working out what’s useful and what’s not.
I just noticed my original post trimmed some of the text in the query method code. My point is you look at the contents of the object and build the query string. That will most likely be a lot more than a line or two of code.
Since V17R6, the query member method on dataclass and entity selection has been updated to support formulas.
Thank you Marie, That’s exactly what I needed!