User.requestIdentity - invoke host function
If I understand correctly how User.requestIdentity works, it is used when it is necessary to generate a record. From what I've seen, the idea behind its use is that the creation is always done by the host, I imagine to avoid the generation of duplicate IDs.
The behavior should be this:
Event
--> if Host --> record generation
--> if client --> generation request to the host with indication of the host function that must perform the activity. The host function receives two parameters indicating whether it succeeded in creating a new ID and the ID to use.
Did I get it right?
Assuming that I have understood correctly how the code should be organized if instead of creating a single record, the request must perform the creation of n records (perhaps with a loop)?
I imagine if the event occurs on the host there would be no problem, but what about the client? Should the client make the request to generate inside a loop? And what happens if for each record generated, other subrecords must be generated (a nested list)?
What I need to generate I have a structure like this:
Code:
<mylist1>
<id-00001>
... fields
<mylist2>
<id-00001>
... other fields
</id-00001>
<id-00002>
... other fields
</id-00002>
</mylist2>
</id-00001>
<id-00002>
... fields
<mylist2>
<id-00001>
... other fields
</id-00001>
</mylist2>
</id-00002>
<id-00003>
... fields
<mylist2>
<id-00001>
... other fields
</id-00001>
<id-00002>
... other fields
</id-00002>
<id-00003>
... other fields
</id-00003>
</mylist2>
</id-00003>
...
</mylist1>
I think it's simple to add an element to mylist2 using User.requestIdentity, just pass it the correct node (e.g.: node -_> mylist1.id00002.mylist2), but what if I wanted to add an element to mylist1 and inside it n elements to mylist2?
And what if I have to generate the entire mylist1 structure with all elements (id0001, id0002, etc.)?
Is there a way to invoke a function on the host, regardless of generating an ID? If that were the case, the host function would do the generation, so I wouldn't have to worry about duplicate IDs.