I want to update an attribute value into an instance but I don’t know if the attribute is already present or not. replace does not work if the attribute is not already present in the instance and insert does not work if it is. What is the best way to do this in XQuery?
I’m using Tamino 4.4.1
What I’ve tried so far:
I tried using if/then/else to first determine if the attribute is present but I couldn’t get the if/then/else syntax to work. Is this supported yet?
I tried using a squence of expressions in a do clause but I could not get that to work either as follows:
update for $settings in input()//Settings
let $config := root($settings)/Config
where $settings/@UserId=‘admiNIstrator’ and
$config/@System=‘gerry_staging’
do (delete $settings/@MainWindowGeometry
insert attribute MainWindowGeometry {“2x1+1+1”} into $settings)
My current solution is to send two separate queries to Tamino, first delete the attribute then insert it. Is there a more efficient way to do this in a single query?
Thanks in advance,
Allen
#API-Management#Tamino#webMethods