Hi David,
I am trying to get a handle on dealing with retrieved PouchDB data but I am stumbling around in the dark and I was wondering if you could give me a hand to better understand how to approach this. For other data, I am able to retrieve a list of records in a grid and then have the user select an item to update it. In this scenario, though, I just want to retrieve a single record representing the particular users profile data and allow them to edit it. I have the following code which is successfully pulling in a single record which is the user's profile record:
You can see in this screenshot that I am populating the Report1 field with the retrieved data using doc.docs, this is just for troubleshooting purposes. What I would like to do is to populate the top three fields with the individual information directly from the retrieved data so that I can allow the user to update it but I am unclear as to exactly what doc.docs does and how to refer to specific data within that array?
Hello Peter,
If I understand well, what you need is to deal with the first item of the "docs.doc" array, or, after set it to the Report, deal with the first item of the Report.Data array. An array variable store their items starting by zero, so the "zero" is the first (and maybe in this case the unique) field of the array. So we can code something like this:
And the same for the other fields. Note that "doc.docs[0]" represent the first item in the array. I am not sure if the key is "FIRST_NAME": you must use the expected key(s), of course.
Thanks David,
I hadn't really thought to utilize the Report field, it was only there for testing purposes but your approach does work and I guess that there is no harm in moving the field off of the view and hiding it.
Thanks for your help!
Pete
Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.