Search the Community
Showing results for tags 'case'.
Hello caspio universe! I came across an issue and wanted to see if someone else had figured this out. I'd like to embed SQL select statements within a case statement so that a calculated field can execute a different SQL select statement based on the case conditions. In psuedo code: Case When [@Virtualfield1] = 'Option1' then Select count(Column1) from tbl1 Else Select count(Column2) from tbl1 End Anyone else find a way to embed a calculation (or SQL statement) within a case statement? My objective here is to run different SQL queries based on the case statement. Thanks for your advice!
Hi I am new to caspio and not a fluent sql programmer but understand some of the logic. I have a Users_table, and a particular submit form, that includes a submitted_by field for the unique email address of the user. I would like to create a report that lists out the users that have not completed the form on that particular day. And a summary table of the number of users completed vs not-completed. Ideally I would be able to include other filters in the pivot. I am having a problem structuring this in the report, can anyone help out with just the first part? Thanks
Hi, I have a Details Datapage where i would like to use a SELECT statements to pull data another table into a Virtual Calculated Field. It goes well so far as pulling the count across all Company_ID's, but when I add RLS to the statement values turn 0 even though the formula is verified. - Both, Booking_Status & Assign_To are in the table Bookings - Assign_To is a text field (255) that match the [@authfield:Company_Users_tbl_Company_ID] I have tried various combinations and expression like: 1. SELECT COUNT(DISTINCT Booking_Status) AS Pending FROM Bookings WHERE Assign_To = '[@authfield:Company_Users_tbl_Company_ID]' 2. SELECT COUNT(Booking_Status) from Bookings WHERE Booking_Status='Pending' AND Assign_To = '[@authfield:Company_Users_tbl_Company_ID]' Though, the formulas are both verified but not working as they return 0, i think perhaps that the table field Assign_To needs to have a FROM Bookings reference, this i have tried as well without luck. I would appreciate very much if anyone have suggestions to a correct statements. Sincerely Ras
It is possible to set checkmark condition using Calculated Value. The field should be set as Calculated Value The basic formula to set the condition is: CASE WHEN [@field:IntegerValue]=100 THEN 'X' ELSE 'Y' END For Yes/No field, the boolean value us 1/0. However, to make it work properly, the field should receive BIT value. So, CAST function should be applied: CASE WHEN [@field:IntegerValue]=100 THEN CAST(1 as bit) ELSE CAST(0 as bit) END