Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

where from 2 lsv?

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

Image

this where service needs to return all entries that have a "y" in the particular column
here are the values in localstorage

Image

How can I combine the column name and value and get the required result.

thank you

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

where from 2 lsv?

Hello!

You would need to add JS in mapping http://devcenter.appery.io/documentat...

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

where from 2 lsv?

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

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

where from 2 lsv?

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

where from 2 lsv?

Hello Michael,

Could you please try to change
prevar areaselectmenu = Apperyio("areaselectmenu").val();/pre
with
prevar areaselectmenu = Apperyio(areaselectmenu).val();/pre

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

where from 2 lsv?

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'

Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

where from 2 lsv?

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.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

where from 2 lsv?

thanks Yurii

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

where from 2 lsv?

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
Image
Image

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

where from 2 lsv?

Hi Yurii,
can you look at my last post, I don't Maryna is talking to me ;-)

Return to “Issues”