justinmind-logo
 
Upvote 1

Update multiple records of a Data Master with a single user action

Answered Michael W 6 years ago

I have been working on this for days and reviewed all of thetutorials and documentation and cannot seem to find out how to accomplish the followingtwo actions, which I believe should be fairly simple.


1 – I would like to be able to modify the contents of aparticular field in a Data Master, for all records (or selected records). I can easily update a field one record at atime, but I want to be able to update a field across all records (or selectedrecords), which would write the same value to a particular field across all records(or selected records), when the user performs on a single action (taps on a ‘save’button for example).


2 – I would like to be able to copy the contents of allfields of a Data Master (all records, or selected records), into a new DataMaster with the identical field structure. I have figured out how to do this one record at a time, but I want to doit for all records (or selected records) from the source Data Master. If this is not possible, another alternativewould be to copy a selection of records from within a Data Master and add thoseas new records within the same data master – again, not one record at a time,but for a range of records with a single user action.

Replies (4)
photo
1

Hi Michael,


1. The example attached should help.

2. Unfortunately this is not possible.


Best,


Sonia Durán

photo
1

Sonia,

Thanks for the example - I believe that will work in my case.

As for #2, while there may not a function which provides this, wouldn't it be possible to achieve this by taking the following approach...

1. Assuming you have a source Data Master of n records, and a target Data Master with the same fields.

2. Create an event to set count the number of records in the source Data Master and Set Value of 'n'.

3. Create an event to read the first record (all fields) of source Data Master and Set Value of each field into a seperate variable which represents each field.

4. Create an event with 'Data Master Action' for 'New' records and write the values of the variables to each field of the target Data Master.

5. Create an event to add 1 to the variable 'count' (this is used to count the rows added)

6. Add a condition for events 3-5 whereby they only are executed when the 'count' is less than or equal to 'n'. Likewise, I think 3-5 would be run 'On Variable Change' when 'count' changes.

I am trying to achieve a loop for 'n' number of records in the source Data Master. Do you think this would work, or is there a better way to accmoplish?

Thanks,

Mike

photo
1

Hi @Michael W, can you share your test .vp file?

Thanks,

np

photo
photo
1

Hi Michael,


You are right. This is a great workaround! . Thank you for sharing.


Best,


Sonia Durán

photo
1

Hi @SoniaDuran and @MichaelW,

In my trial period of JIM, I am also trying similar thing as laid out in # 2, by Michael above, and facing many challenges. In my case, I am trying to populate fields of a tapped row from the source data list into a new in the target data list using the Exec New data master action event. No luck.... Any thoughts what I am may be doing wrong? My event is wired on the click TAP event at the current row widget.

Also, I am stuck at getting records created into the data master. The Execute New event is not creating a new record into the target data master. Am I missing any settings for this to execute? I was looking for commit like option but couldn't find that either. Your help will be appreciated.

Thanks,

np

Leave a Comment
 
Attach a file