Page 1 of 3
where from 2 lsv?
Posted: Tue Aug 05, 2014 10:27 am
by Michael4771079
Hi folks,
I am trying to implement a where service using 2 lsv.
I am working with a selectmenu which has a 4 locations as label and the letter "y" as value of all 4.
When selectmenu value changes they are saved in localstorage, this is the collection in the db
this where service needs to return all entries that have a "y" in the particular column
here are the values in localstorage
How can I combine the column name and value and get the required result.
thank you
where from 2 lsv?
Posted: Tue Aug 05, 2014 12:17 pm
by Maryna Brodina
Hello!
You would need to add JS in mapping http://devcenter.appery.io/documentat...
where from 2 lsv?
Posted: Tue Aug 05, 2014 2:12 pm
by Michael4771079
Im sorry,
I just not getting this,I have tried a few variations but no success
this is the last one, but not correct
Is there a sample available
codefunction(value, areaselectmenu) {
var areaselectmenu = element.val();
var areaselectmenu = Apperyio("areaselectmenu").val();
return '{"$and": [{"category": "'+category+'"}]}';
}/code
thanks
where from 2 lsv?
Posted: Tue Aug 05, 2014 7:16 pm
by Michael4771079
hi Evgene,
any chance for a clue here or a sample of how to address this issue,
if I only needed the value of selectmenu I can do that,
but this is trying to ensure the correct column is queried for the selectmenu value, without knowing which item has been selected from the selectmenu
cheers
where from 2 lsv?
Posted: Tue Aug 05, 2014 8:50 pm
by Evgene Karachevtsev
Hello Michael,
Could you please try to change
prevar areaselectmenu = Apperyio("areaselectmenu").val();/pre
with
prevar areaselectmenu = Apperyio(areaselectmenu).val();/pre
where from 2 lsv?
Posted: Tue Aug 05, 2014 9:04 pm
by Michael4771079
hanks for that,
i tried that and got errors 1 and 2
below is the screenshot
errror 1, missing name in function declaration
errror 2, 'areaselectmenu is already defined'
where from 2 lsv?
Posted: Wed Aug 06, 2014 3:47 am
by Yurii Orishchuk
Hi Michael,
Here is a code without these errors:
pre
function someFunctionName(value, element) {
var areaselectmenu = element.val();
areaselectmenu = Apperyio("areaselectmenu").val();
Code: Select all
return '{"$and": [{"category": "'+category+'"}]}';
}
/pre
Regards.
where from 2 lsv?
Posted: Wed Aug 06, 2014 9:28 am
by Michael4771079
where from 2 lsv?
Posted: Wed Aug 06, 2014 9:28 am
by Michael4771079
Hi Maryna
I have used Yurii code and the service runs, but it not working correctly.
its returning all collections and not the 2 values on the selectmenu
let me explain,
in the collection there are 5 area columns
westlothian,falkirk,dunfermline,stirling and east_central_scotland(left blank for testing)
the only data in these columns are "y" and "n"
my get service should only return those enteries which have a "y" in the column selected with selectmenu
it seems to be returning everything
if I select east central scotland for example it still returns all listings even though there are no values at all in this column
whatever I select from the selectmenu the results are the same (all records are returned)
the screenshot shows a search for east central scotland and it should return nothing
no errors in console
here are some screenshots
where from 2 lsv?
Posted: Wed Aug 06, 2014 10:10 pm
by Michael4771079
Hi Yurii,
can you look at my last post, I don't Maryna is talking to me 