and more in a single search tool across platforms. Read the announcement here. |
10/04/2023 05:32 AM
Hello All,
We have a requirement to update users department column based on entitlement value.
In GRANTACCESSJSON of DB connection using below syntax but it is giving error
{
"Role" : [
"Update DBNAME.TABLENAME Set USERDEPT=CASE WHEN ${task.entitlement_valueKey.entitlement_value=='ROLE_USER'} THEN '' ELSE ${task.entitlement_valueKey.entitlement_value} END where USERID = '${task.accountName}'"
]
}
Error message - [SQL0199] Keyword THEN not expected. Valid tokens: < > = <> <= !< !> != >= ¬< ¬> ¬= IN NOT.
Please help me to fix this issue.
Thank you
10/05/2023 01:23 AM
Hi @harishyara
Can you try the below code and check if it works:
{
"Role" : [
"Update DBNAME.TABLENAME Set USERDEPT=CASE WHEN ${task.entitlement_valueKey.entitlement_value}='ROLE_USER' THEN '' ELSE ${task.entitlement_valueKey.entitlement_value} END where USERID = '${task.accountName}'"
]
}
10/05/2023 06:31 AM
Hello @armaanzahir I tried with your syntax still throwing same error.
10/05/2023 09:50 AM
@harishyara : Try below logic
{
"Role" : [
"Update DBNAME.TABLENAME Set USERDEPT=NULLIF(${task.entitlement_valueKey.entitlement_value},'ROLE_USER') where USERID = '${task.accountName}'"
]
}