Which SC steps for multi updates in a single column for single user (screenshots)?

It seems your query, used to populate form data is not returning a value for userid.
Please check if the consultDetailsConnect.data.qryKeywords returns userid and if not, make sure to put the correct binding here:

Thanks I fixed that too (consultDetailsConnect.data.userid) but not only do i still get no data updates, now the existing data is being deleted from the table.

Because again the expression selected is wrong. It should not return the same value for all records…

Sorry, lost, I don’t see what’s wrong. My ServerConnect does return userid so the userid here looks correct.

On your screenshot you have not selected a server action in the populate field?
You must select a server action there, which populates the values in your form.

Your server action used in populate should return this value userid otherwise select the proper value from it…
I really don’t understand how did you end up with such a mess when this is such a straightforward process.
You just need a server action which updates the records and another one which is used to populate your form data. Both need to return the same bindings/columns from your database.

Yes I did populate first and selected multi record. This table is the result of the populate. This is after populating and running the bootstrap generator again to reopen this window.
In the dev tools, all seems fine on both panels:


image

No it does not look fine! It should not return the same id for your records! You need an unique id returned.
How would the update record update any record if you are using the same id for all of them? Are sure you are even using the proper column for update record condition?
I suspect you are just using some totally wrong id in the update step, not the record identity column

But these keywords are all for one single user, for one user’s profile.
What are these userid for then? Do you have docs or tuto abt the operation Im trying to accomplish?

You need to use the unique identity for your records to update them. Update record identifies the record by it’s unique id.

That’s my setup in the DB update conditions

How are you even storing these values in the database? Aren’t they stored in a separate table, with an unique id for each record?

The update record needs that unique id, not some value which is the same for all records.

1 Like

Okay now I think I got it. I need to use the ID column, not the userid
image

Well of course you need to use it. How would the script know which value to update if you don’t pass its unique id?

So the ID attribute should be the index, right? And same for the DB update?
image

Now that I understand, i get what I want. Just one more question, where is best to set the start value of index to 1 instead of 0? Create a set value?

The value must be your id column, not $index
Screenshot 2021-02-16 at 10.29.24

Thanks a lot for your patience and help here! I’ve learned a lot.
For the readers/newbies who want to learn too, here are a few screenshots of how I made it happen (anyone feel free to suggest fixes in my steps/wording if you want):

First, in the Server Connect side (SC) make sure in your API steps that you have a DB query that fetches the data you want to work with + the column ID which will be your unique identifier for updating a desired row.
Then in App Structure (AS), have a server connect action that fires the API DB query action.
Then still in the AS, you need to generate the form (multi record toggled on), by populating the data from the query including the column ID.

Have the input fields (under your form in the AS) you want to display under a repeat loop by clicking Make Children Repeat.
image

Back in the SC, import the input properties from the form you’ve just generated in the AS.
image
It will generate a ‘Record’ array (due to the repeat) of the variables you need to work with.

The variables will be generated with the proper field properties. Keyword:
image

ID (the column identifier):
image

Then add the action steps for updating the DB. Select the DB multi record update in the DB action (right click) and it will generate the repeat ‘record_repeat’ action and the DB update within it.
image
Add the desired output fields in the repeat properties.

In the DB update options, have the following conditions to make sure the data is updated upon the unique column ID and userID or else the script does not know which value to update and Teo will get mad. :wink:

2 Likes