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 …
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.
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
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
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
@Marzio, I am new to wappler but used such task a number of times in my project.
So start with new SC.
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)
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.
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 ?}
Use these parameter values for comparison and in update query.
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) .
Tick the no auto load option and delete the parameter in SC properties panel.
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.
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.
Please check these and come back with the results so we can go on further.