case condition is not working in the insert query.
-
Goal:
-
Steps:
-
Details:
-
Screenshots:
Goal:
Steps:
Details:
Screenshots:
Hi @Jame,
You're missing the }}
after {{affordableFloorPlanProgram.value[1]
(on the line highlighted in red.
thanks..still having issue
Is it correct to add 'case condition' in between insert statement in retool?
it look like you want to write a query that includes the CASE and then to insert the results of the query. You are currently inserting values which should just be a list of values.
The form for a query insert should be something like:
INSERT INTO foo
SELECT
bar.buz,
CASE
WHEN bar.buz = ‘cond1’ THEN 0
ELSE bar.array
END
FROM
bar
WHERE
bar.limit = ‘limiting criteria if needed’
Or you can use a ternary operator instead of the CASE when creating your list from variables: