Re: How to use collection.query for specific element of embedded collection

2019-04-26 Thread Keisuke Miyako via 4D_Tech
square brackets have a specific meaning in query by attribute see Example 5 or Linking array attribute query arguments (16R2 and later) https://doc.4d.com/4Dv17/4D/17.1/QUERY-BY-ATTRIBUTE.301-4178904.en.html > 2019/04/27 2:01、Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com>のメール: > > $queryString

Re: How to use collection.query for specific element of embedded collection

2019-04-26 Thread Christian Sakowski via 4D_Tech
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/Regar

Re: How to use collection.query for specific element of embedded collection

2019-04-26 Thread Jim Hays via 4D_Tech
Kirk, You might try .find() or .findIndex() for that kind of thing. I've only used .query() directly on attributes (field names) in entity selections so far. Jim On Fri, Apr 26, 2019 at 1:01 PM Kirk Brooks via 4D_Tech < 4d_tech@lists.4d.com> wrote: > Imagine a collection or entity selection pop

How to use collection.query for specific element of embedded collection

2019-04-26 Thread Kirk Brooks via 4D_Tech
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 e