How to use query output in severconnect

I have a server action. in that server action i have this in this order:

1- database connection
2- database query
3- database update

my question how can i use the result of the database query in the database update? the data bindings doesn’t let me choose the output value of a spesifc column. only the whole query like so {{database Query}}

Have you created a GET variable in your action?

For? i have one to get the id i want to update.

That is the variable I mention. So that part is working for you? You get the proper values in your update form?

I’m not sure I quite understand what you are trying to do? :frowning:

i thought i make it simple by the list :sweat_smile:

i want to calculate the total using mysql SUM then update other table with that total.

I was able to do it.
but sadly its not possible with the data binding view. you have to type it.

to anyone want to do this:
in the query you want to get the result from (sum, avg, etc…). set up your query like so:(you can add as many columns as you want)
select SUM(price) AS totals FROM detail WHERE.....
now on the insert or update step after that we set up. you simple type this in the field you want to hold the sum value:

Of course you can do it in a single server action, there is a special action step called “repeat” for this.
So you can do something like this:

  1. database connection
  2. database query
  3. repeat through the query
  4. for each record do database update

but if all this is only for calculating a SUM - you can just select the SUM as field aggregate in the database query and you are done!


1 Like

i never asked how to update multiple records or how to calculate the totals.

How can you access the result of a query from server side? that’s the question

Well easy - just use the server side data picker on the places where expression can be entered

can you please show a screen shot selecting the result of a sum in server side?

How do you wan to use it? In a different step (what kind) or as output?

in a different step
calculate the sum total
then update a table with that total

  1. Make the database query with SUM - give it an alias for the conveniance

  2. Add a repeat below it - because even if it is a single record it returns an array of records. Bind it to the name of the query

  3. Add the update query inside

  4. double click on the field that you want to update and thunderbolt to get the data picker

  1. save all the actions and there you have it

thats great
but if i only have one record will my solution be ok?

Yes sure - it is pretty much the same :slight_smile:

i will mark your replay as answer then since its better

1 Like