4D v16 is providing you with an enhanced integration of object fields in your database.
If you have already pre-selected sets of an object field, you can now query these sets using only one 4D command: easy and fast!
The QUERY SELECTION BY ATTRIBUTE command works exactly the same as QUERY BY ATTRIBUTE existing command, except that the search is performed among the records currently selected by a previous query or a set for example.
// ask a city to the user for performing the query
$value:=Request("City";"Springfield")
$recordInSet:=Records in set("userSet")
//
// Is the set (selection) is empty?
If ($recordInSet>0)
// may be in 1st level attributes
QUERY BY ATTRIBUTE([Samples];[Samples]OB_Field;"City";"=";$value;*) // query is not finished...
// or in a adress (with . path)
QUERY BY ATTRIBUTE([Samples]; | ;[Samples]OB_Field;"Address.City";"=";$value;*) // query is still not finished...
// or in an adress array (with .[]. path)
QUERY SELECTION BY ATTRIBUTE([Samples]; | ;[Samples]OB_Field;"Address.[].City";"=";$value) // now, query is executed !
//
//You can mix different query commands for defining the query
//
Else
// the selection is empty, alert the user
ALERT("There is no selected contacts. Please select contacts in the list.")
End if
More details can be found in the QUERY SECTION BY ATTRIBUTE command documentation.