Hi Kirk,
in your example it should work like:
$obj:=New object("id";"some string";"fields";New collection(New
object("i";0;"name";"value1");New object("i";1;"name";"value2");New
object("i";1;"name";"value3")))
$selection:=$obj.fields.query("(i == 1) && (name == :1)";"value2")
--
Grüße/Regards,
[heubach-media] | Christian Sakowski
[email protected]
Tel: +49/(0)40/41 455 455
> Am 26.04.2019 um 19:01 schrieb Kirk Brooks via 4D_Tech <[email protected]>:
>
> Imagine a collection or entity selection populated with objects like:
>
> {
>
> id: "some string",
>
> fields: [
>
> {i:0, name:value1},
>
> {i:1, name:value2},
>
> {i:2, name:value3},
>
> ...
>
> ]
>
> }
>
>
> I want to find collection elements by searching for 'fields[1].name' =
> someValue.
> That is, only matches on the second element.
>
> I thought the query string would be:
>
> $queryString:="fields[1].name = :1"
>
>
> But this throws an error:
>
> Array element reference must be a letter in the object path: fields[1].
>
>
> The query works without attempting to limit it to the particular collection
> index.
> What's the correct syntax for this kind of query?
>
> Thanks!
>
> --
> Kirk Brooks
> San Francisco, CA
> =======================
>
> What can be said, can be said clearly,
> and what you can’t say, you should shut up about
>
> *Wittgenstein and the Computer *
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive: http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub: mailto:[email protected]
> **********************************************************************
--
heubach media
Osterfeldstr. 12-14 | Haus 1 | Eingang Nord
22529 Hamburg
tel: 040 / 52 10 59 - 10 | fax: -99
mail: [email protected]
home: www.heubach-media.de
Geschäftsführer|CEO: Matthias Heubach
Mieten Sie Ihre Computer, iPads & Drucker für Ihre Events bei:
http://www.milo-rental.com
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten
haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht
gestattet.
This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the
material in this e-mail is strictly forbidden.
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************