SQL problem

95 views
Skip to first unread message

karam mohammed 1

unread,
Sep 3, 2025, 1:09:05 PM (9 days ago) Sep 3
to mementodatabase
Hello, I use this SQL to filter library entries by (Done ) field, which is Boolean field . The filter work only if done is checked in edit modebut didn't work if I check Done in card , table or list enteries 
Thanks in advance 

SELECT 
  id,
  "Patient",
  "Done"
FROM "test 2"
WHERE 
  removed = 0
  AND CAST("Done" AS INTEGER) = 0

David Gilmore

unread,
Sep 4, 2025, 10:31:56 AM (8 days ago) Sep 4
to mementodatabase
I suspect your issue is that when a field is updated in the Edit screen, the "Before/After Create" and  "Before/After Update" triggers are run. However, when updating a field in a card, table or list view, those triggers are not (the Before or After Field Update triggers are run, though).

But why are you doing the "Cast"? Why not just:

 SELECT id, Patient, Done from "Test 2" WHERE removed = 0 and Done = false

karam mohammed 1

unread,
Sep 8, 2025, 7:40:05 PM (3 days ago) Sep 8
to mementodatabase
i tried this and it didn't work . the problem is only with Boolean field

David Gilmore

unread,
Sep 9, 2025, 11:27:32 AM (3 days ago) Sep 9
to mementodatabase
It certainly works for me, both on Android and on the PC. Could you share whatever error message you might have gotten?

David Gilmore

unread,
Sep 9, 2025, 11:53:29 AM (3 days ago) Sep 9
to mementodatabase
I take it back. My test was incorrect, it does fail on the PC like you say. But does work on Android.

David Gilmore

unread,
Sep 9, 2025, 12:39:09 PM (3 days ago) Sep 9
to mementodatabase
Further correction: I did get it to work on the PC. (Scripting is a little different on the PC than it is on Android. I rarely script on the PC).

But I did the where clause without the CAST to work on the PC .

karam mohammed 1

unread,
Sep 11, 2025, 9:42:11 AM (20 hours ago) Sep 11
to mementodatabase
With Boolean?

David Gilmore

unread,
Sep 11, 2025, 9:53:20 AM (20 hours ago) Sep 11
to mementodatabase
Yes, exactly as I showed. Remember that the "false" is in lower case.

I had some problems when testing my SQL string on the PC, which I was able to finally fix by closely examining the error messages. Which is why I asked to see yours.

Reply all
Reply to author
Forward
0 new messages