Dynamically add values in table, from the tags?

Hello How can i add the Delieverydate value into the Database? is there a scripting needs to be done on UDT? and i have set the “DelieveryDate” datatype to be “TEXT” in the query, please correct me on that too, if that is wrong, i tried to use “STRING” but did not like it.


Where’s your insert statement that is populating your joblist table? That is what needs to include the value of your DeliveryDate tag.

Hello, i am not sure about the insert statement, but i believe this query is populating my current table.

No, somewhere else there is a query which is inserting data in to the database. That query would need to include your delivery date, this could potentially be in a third party software.

In other words, where do the jobs in the joblist table come from?

1 Like

Might be helpful to do a Control+F to search your project, and look for INSERT INTO joblist to see if it appears in any scripting somewhere.

I found this thing, not sure if that is making that work or not? i added deliverydate too not sure still
if i am on the right track

Couple of things here. I see you did add "DeliveryDate": deliveryDate to the parameters and that is necessary, but is there a part above that where you define the variable deliveryDate? You will need to do that. Something like delieryDate = system.tag.readBlocking(['path/to/your/deliveryDate'])[0].value - this is what will grab the tag value.

After you do this - go over to the named query called addJob.

There, add a parameter called DeliveryDate - it must match exactly what you called the key in your parameter dictionary (your params variable), case sensitive, so just copy and paste or double check yourself. Set it to a datetime type of parameter (assuming you are using a datetime column type in your database which you should if you are not for dates), and then you will have to add the column/parameter to your actual insert statement to now insert this parameter into that column.


Hello i followed the procedure that you recommended, it works fine for when adding new job with button control however, it does not effect the data that has been previously entered. I added deliveryDate column just recently but that data (job# & delieverydate on UDT) was already there. How can i update delieverydate Column in table to its corresponding UDT?

Thank you

The simplest solution might be to run a one time script. You can probably even do this from the script console.

I can’t write the script right now, but if you know python it shouldn’t be too hard:

  1. use ‘system.tag.browse’ to find UDTs that correspond to jobs
  2. read the DeliveryDate
  3. use the instance name to find which row to update in the table
  4. use update {table} set {delivery column name} = deliveryDate where jobnumber = {instance name}

This should be enough.

hello, thank you for response.

i am not sure where to use system.tag.browse and how can i have my system.tag.browse to dynamically see the UDT and read deliverydate. Do i have to create another query inside my Named queries to do this update or somewhere else?