Perspective Table Update

I got this working based on everyone’s feedback @victordcq, @pascal.fragnoud @leonardo.godoi @josborn (Thank you!).

So here is what I did for further references (There are two ways to solve this, either with a query tag and binding the tables’ data to the query tag, or directly binding the table’s data to named query):

  1. Created this perspective view with one table component, two text fields, and one button

  1. Created a query tag with the execution mode to be tag group (the execution mode has to be tag group not event-driven).
    ** Set the database as your Datasource in the tag editor.

I wrote the query of the tag as below:

SELECT * 
FROM yourdatabasename
ORDER by rack_data_id DESC
  1. Bound the table data to the query tag.
    You can skip the 2nd section and directly bind the table’s data to a named query instead which is easier. @pascal.fragnoud

  2. add a script for the button on the mouse click:

	rack_sn = self.getSibling("TextField").props.text
	state = self.getSibling("TextField_0").props.text
	system.db.runPrepUpdate("INSERT INTO  \
	   yourdatabasename\
	    (rack_sn, state) \
	    VALUES (?,?)", [rack_sn, state])

And now, when you click on the button, a row is being added with the texts you entered into the table, it is also being added to the database as well :slight_smile: