With the foundset updater, you can set some value into a column and then this will generate a SQL script like this:
UPDATE table
SET columnX = 1
WHERE <condition>
The decided by Servoy based on the foundset. This works well.
But in the same way I would like to fill my column with a value of another column, so like this:
UPDATE table
SET columnX = columnY
WHERE <condition>
I don’t see why this should be a big problem for Servoy, but the updater doesn’t accept it, when I use:
_updater = databaseManager.getFoundSetUpdater(foundset)
_updater.setColumn('columnX, 'columnY')
_updater.performUpdate()
then Servoy fails because columnX is a numeric type.
Could this be a functionality for a next version of Servoy?
Martin,
You can use the third option described in the foundsetUpdater docs: http://wiki.servoy.com/display/public/D … SetUpdater
Loop through the updater simultaneously with the foundset and assign the column value.
Rob
rgansevles:
Martin,
You can use the third option described in the foundsetUpdater docs: http://wiki.servoy.com/display/public/D … SetUpdater
Loop through the updater simultaneously with the foundset and assign the column value.
Rob
Rob,
For this option I don’t need an updater.
I can loop thru the foundset as well without an updater.
I just wanted with 1 single SQL-statement to do this update without loop and without using rawSQL.
Maybe adding a new method to the updater in the next version?
setColumnXToColumnY(nameX, nameY)
It would be even more perfect if the nameY can also be a related field, for example:
setColumnXToColumnY(‘columnX’, ‘tableX_to_tableZ.columnZ’)
with the only condition that the relation ‘tableX_to_tableZ’ was already used in the original foundset.
Since you already have the query including the joins, I don’t think this will be too hard to implement.
But it will improve the performance.
Martin