Action for each record

I have a table with a list of records and for each row as well as IDs and data, I have associated a form with a button.
For each record, by clicking on the button, I want an action that contains some queries to be performed
If in the queries I insert the values manually it works, but if I insert the conditions I don’t know how to associate them
For example, I would like to be able to enter the ID of the record and the ID of another query on the page
In the action I can create GET or POST variables but …

result

@Teodor

Does anyone know how to solve?

We have to define GET variable in SC and pass these parameters from page (like delete or update action). Then in SC we can use them in any query. This will work for single record. For multiple records pass query parameters as GET variable and use them in SC for query the records and then use repeat.

Thank you but I don’t understand how it is necessary to proceed

I am using GET variable to get parameters in query (image shows that POST is used in your case). The query result shows that they are returning null value. what are initial two queries?

Maybe I went to complicate things and I can’t get out of it anymore
My problem is that I have some data from a previous page on the page (connected with Uuid as a parameter)
Server Connect regularly reads the data from a record of the “Tickets” table
Then in another section of the page I have a list of records from a table (travel) relating to the ticket (selected with UUID)
In the list for each record there is a button for a trip choice, and by clicking it should update a data of the table (tickets) and some data of the travel table, as well as send to a further page …

What I’m trying to do is create an action to be attracted in the chosen record button
This is the action

What is is output of first two queries? (Earlier, it was null). If output is null then we have to check the queries.

It is still zero, but the problem is that the Get variables inserted in the GET inputs do not evidently correspond to anything and Wappler does not apparently allow me to configure them

If I insert the conditions in the queries manually with real values the query work
For this I think it is a problem of variables

How are you passing variable to SC. The value should be passed in page button click dynamic events. (see doc on update or delete)

I tried various solutions, following your advice but I can’t get it to work
I explain what I’m doing

The page receives from the previous page the general data of TABLE A



On the page there is also a list of records from TABLE B


for each record there is a button


My requirement is this:
By clicking a record button, 3 events should occur:
—1----
update the record of Table B, modifying two fields, subtracting the relative values of Table A
—2----
update a field of Table A, with the validity of a field of the record of Table B
—3----
link to a new page with UUID parameter

This the action for fist upgate

Schermata 2023-07-09 alle 01.09.20 Schermata 2023-07-09 alle 01.10.23 Schermata 2023-07-09 alle 01.10.57

@Marzio, I am new to wappler but used such task a number of times in my project.

So start with new SC.

  1. Define GET parameters - As your button is in table B, you can pass the id of this table from table-repeat on page. How to pass id of table A is you have to think, As you have to update table A also. (I hope these are two separate tables in database)

  2. Add server connect comp. on page and link to it. Don’t define any parameter here as you can only get [0], first record as in image. Define parameters only in button click event.

  3. In SC, add single query with id of table B, to get other parameters (posti and cani). (as per images, how your passing two other parameters ?}

  4. Use these parameter values for comparison and in update query.

  5. same can be done for table A.

hey @Marzio,

I am sure that what you will find the solution.
Let’s try to find what the mistake is…

I don’t fully understand your structure and what are you trying to do and the most important is HOW are you trying to do it:

I suppose you use get variables

Then on the “Orario partenza” button click event you call the “sc_update_viaggio” SC passing the IDviaggio parameter.

What I see here is that your “sc_update_viaggio” SC doesn’t have the no auto load option ticked (so it runs on page load without a reason and cause problems) and you have defined already in the properties as parameter the tableRepeat[0].IDviaggio value.
(by the way, [0] indication always send the first record and not the current like [$index] indication does) .

  1. Tick the no auto load option and delete the parameter in SC properties panel.
  2. Leave empty the parameter of your “sc_update_viaggio” SC since it will run only when a button is clicked and send the specific idviaggio value on server.
  3. I see GET and POST parameters (keys) with uppercase letters… I am not sure if this is a problem but you better use only lowercase letters. Of course in addition I don;t know if the same name with uppercase is not causing problems… IDviaggio as a $_GET and idviaggio as a $_POST keys.
    image

Please check these and come back with the results so we can go on further.

Ok I’m going to order:
changes made, and now the situation is like this:
Action update


This result:
Schermata 2023-07-09 alle 09.25.12

SC now
Schermata 2023-07-09 alle 09.27.07

My friend Marzio,

Please

  • change the GET name to id_viaggio
  • update your query properly
    {{$_POST.IDviaggio}} THERE IS NO IDviaggio post variable…

I did not understand this
I don’t seem to have ever used in this project ----> id_viaggio with Underscore

this database
Schermata 2023-07-09 alle 09.37.03