Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**********************************************************************************
- queryByFormula
- $inTable -> Table pointer Table to apply query
- $inExpression -> Text Expression to execute for each record,
- should evaluate to a boolean
- $context -> Collection Values for use in the expression
- Allows you to execute a QUERY BY FORMULA using Active4D variables
- and methods. This is the functional equivalent of the QUERY BY FORMULA
- command from v4.5.
- If $inExpression is empty, the current selection of $inTable will be empty.
- **********************************************************************************/
- method "queryByFormula"($inTable; $inExpression; $context = 0)
- if (length($inExpression) # 0)
- $inExpression := "return ({0})" %% ($inExpression)
- all records($inTable->)
- $set := "a4d.utils.queryByFormula"
- create empty set($inTable->; $set)
- for each($inTable->)
- if (execute($inExpression))
- add to set($inTable->; $set)
- end if
- end for each
- use set($set)
- clear set($set)
- first record($inTable->)
- else
- reduce selection($inTable->; 0)
- end if
- end method
Add Comment
Please, Sign In to add comment