I just want it to search in multiple columns but the text in the input only has to meet the criteria of one column. So even when I try to search for something that I know is in the database, it won't show up.
I just want it to search in multiple columns but the text in the input only has to meet the criteria of one column. So even when I try to search for something that I know is in the database, it won't show up.
Hello!
If it isn't showed up when you expect to see it, then:
1) your rule is wrong
2) may be you need to use "$or" instead of "$and"
Could you please write what is the rule for your query ?
I changed it to $or and results don't go away when I search for something unrelated. Here is the code I used.
var select = localStorage.getItem("bookid");
var search = Apperyio("mobilesearchbar_282").val();
var cow =Apperyio('mobiletextinput_cowid').val();
var sire =Apperyio('mobiletextinput_405sire').val();
var color =Apperyio('mobiletextinput_406color').val();
return '{"$or":[,{"calf_id":"'+search +'"},{"cow_id":"'+cow+'"},{"sire":"'+sire+'"},{"color":"'+color+'"} ]}';
My app is shared with support and called The Calving Book. The screen1 search_service is where you will find this implementation.
Hi Ellen,
It's better to use direct JS objects:
For example following JS code:
pre
var whereObject = {
"$or": [
{"calf_id": search},
{"cow_id": cow},
{"sire": sire},
{"color": color}
]
};
return JSON.stringify(whereObject);
/pre
Regards.
Unfortunately, that didn't work.
HI Ellen,
Do you need further help?
If so - please provide us additional information.
For example, what you expect, what is not work, screen shot with information about request (parameters and headers) and screen shot what service returns.
Regards.
I want a collapsible list item to appear if it matches the criteria. The criteria is just if it matches in the search input or if they search li, lion, listen, and little should all show up.
Dear Ellen,
We are very sorry, but custom logic is something outside the scope (http://devcenter.appery.io/support-po...) of our support.
You can show us what you have tried and what does not work, so we can suggest.
You may consider purchasing Advisory Pack to get more in-depth help on this question. Here is more information about Advisory Pack (http://appery.io/services/#Advisory_Pack).
I tried adding this code as Yurii suggested. I don't have anything mapped to the 'where' parameter. I only have this code there.
var whereObject = {
"$or": [
{"calf_id": search},
{"cow_id": cow},
{"sire": sire},
{"color": color}
]
};
return JSON.stringify(whereObject);
I get this error in the console when I try to search.
Hi Ellen,
This you should debug your app to find a reason of this problem.
It seems something wrong with transformations.
Regards.