Hello,
I am using Stable Runtime Version 4.84.7.
I am having a problem with querying on multiple-choice values using contains. I have a template in which I have selected the following values for allow_creation_from: On Demand Inspection, and Inspection Plan.
I attempt to query for templates where the allow_creation_from field contains “On Demand Inspection”. Here is my code for doing so:
view.templates = DB.checksheet_template.where("is_deleted != ? and (allow_creation_from contains ? or allow_creation_from = ?)", true, ALLOW_CREATION_FROM_ON_DEMAND_INSPECTION, ALLOW_CREATION_FROM_ON_DEMAND_INSPECTION)
.orderBy("-last_modified_at").include("project","created_by");
view.issue_templates = DB.checksheet_template.where("is_deleted != ? and (allow_creation_from contains ? or allow_creation_from = ?)", true, ALLOW_CREATION_FROM_ISSUE_REPORT, ALLOW_CREATION_FROM_ISSUE_REPORT)
.orderBy("-last_modified_at").include("project","created_by");
The second query (view.issue_templates) only has “Issue Report” selected, and I am able to query the issue templates successfully. However, the first query does not show up any results. When I only select “On Demand Inspection”, and remove “Inspection Plan”, I am able to query successfully though.
Shouldn’t the contains detect that I have “On Demand Inspection” selected? Or is there something wrong with my code?
Thanks,
Alex