Picking up from my earlier thread … I’ve created a question with a variable gender which is a field filter mapped to gender. Two scenarios for the SQL below:
SELECT count(*) AS "count", "public"."investors"."gender" AS "gender" FROM "public"."investors" WHERE TRUE [[AND {{gender}}]] GROUP BY "public"."investors"."gender" ORDER BY "count" DESC, "public"."investors"."gender" ASC
- With no value in the filter drop down, it works OK!
- With a value selected from the filter drop down (ex. m), I get the following error - ERROR: operator does not exist: gender = character varying Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Position: 260
Now I change the SQL to
SELECT count(*) AS "count", "public"."investors"."gender" AS "gender" FROM "public"."investors" WHERE TRUE [[AND {{gender}}::gender]] GROUP BY "public"."investors"."gender" ORDER BY "count" DESC, "public"."investors"."gender" ASC
- With no value selected from the filter drop down, I get the following error - ERROR: cannot cast type integer to gender Position: 235
- With a value selected from the filter drop down (ex. m), it works - OK!
Any suggestions on what I can do to fix this?