SELECT with where doesn't work where [] does
Guys I am puzzled.
This works
let filterCat := text('Category Filter');
let filterMonth := text('Month Filter');
let filterYear := text('Year Filter');
(select Expense)[contains(filterCat, text('Expense Category')) and
contains(filterMonth, monthName('Expense Date'))]
But this doesnt
let filterCat := text('Category Filter');
let filterMonth := text('Month Filter');
let filterYear := text('Year Filter');
select Expense where contains(filterCat, text('Expense Category')) and
contains(filterMonth, monthName('Expense Date'))
as info: the 3 filter *Filter fields are multiple choice elements
thanks for pointing me to surely the stupid mistake....
17 replies
-
just to add more context --- may be the issue?
'Expense Category' is a field of the 'Expense and it is a dynamic choice.
-
Hi Not sure, bit I think you have the two arguments for contains() the wrong way round, so, for example, the first one should be
contains(text('Expense Category'),filtetrCat)
Regards John
-
Can you upload a sample DB so we can take a look at it?
-
Works fine for me on Android Tablet
-
Tried a couple of things and found that this works:
let catNum := numbers('Category Filter'); select Expense where contains(catNum, number('Expense Category'))
Seems like the app does not like text in contains in where. Weird.
Luckily Category and Months are easy to get numbers for. For the Year Filter you have first get the text then convert it into a number with something like:
let filterYear := for text in split(text('Year Filter'), ", ") do number(text) end;
So the code would look something like:
let filterCat := numbers('Category Filter'); let filterMonth := numbers('Month Filter'); let filterYear := for text in split(text('Year Filter'), ", ") do number(text) end; select Expense where contains(filterCat, number('Expense Category')) and contains(filterYear, year('Expense Date')) and contains(filterMonth, month('Expense Date'))
You should still report it as text should also work, but at least you have a work around.
Content aside
- 19 hrs agoLast active
- 17Replies
- 62Views
-
4
Following