10-18-2022 12:41 AM
Hi! I was trying to display the Statuskey of the user in the Update User Form and be able to update it as well. The below queries worked as expected:
Default Value | SELECT statuskey as ID from Users u where u.userkey=${requestee} |
Values | SELECT distinct statuskey as ID from Users u |
But instead of 1 and 0, we need to show them as Active and Inactive. Values work just fine using below query:
Values | SELECT distinct CASE WHEN statuskey = 1 THEN 'Active' else 'Inactive' END AS id FROM users; |
But as for the Default Value, which should show the current status of the user to be updated, the query below is not working and it returns blank result in the User Update Form:
SELECT CASE WHEN statuskey = 1 then 'Active' else 'Inactive' END AS id FROM users u where u.userkey=${requestee} |
Can anyone suggest the right query for this requirement? TIA.
Solved! Go to Solution.
10-19-2022 07:35 AM
I do not think that the default values for a Single Select SQL query is auto populated in the form. You could try and see if Multiple Select from SQL instead of Single Select work for you.
10-21-2022 06:59 AM
The default values for a Single Select SQL query is not auto populated in the form.
11-24-2022 12:52 AM
Hi,
you can set a "User Column" and then you don't need a default value at all as the data from the users table will be populated there.
You can also use an inlinedescription to show the description of the values:
SELECT DISTINCT statuskey AS ID,
CASE
WHEN statuskey = 1 THEN 'Active'
ELSE 'Inactive'
END AS inlinedescription
FROM Users