eascards
Posts: 0
Joined: Mon Jul 14, 2014 2:42 am

More Detail on using the select menu

So now the whole feature works as long as the default book is still selected. For some reason, the popup that displays the _id doesn't necessarily show the correct id. It only shows the id of the default book selected even if something else is selected.

These are my settings for the LSV: Image

This is the mapping that I use to get the id to the label: Image

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

More Detail on using the select menu

Eascards,

Here is what you have to do:

1 Set following mapping: http://prntscr.com/4hjbhq/direct

2 On select change - set "bookid" with selected item value. http://prntscr.com/4hj8c4/direct

3 In list/query service mapping link "bookid" to where parameter: http://prntscr.com/4hj8rd/direct

4 Click Edit js and paste following code: http://prntscr.com/4hja0r/direct

pre

var whereObject = {"Book": value};
return JSON.stringify(whereObject);

/pre

I've fixed this. Currently it should work.

But note you have strange link in your DB by book name. "Book" stores name currently. But it good way to store there "_id" instead.

Regards.

eascards
Posts: 0
Joined: Mon Jul 14, 2014 2:42 am

More Detail on using the select menu

I just noticed that this doesn't search based on what is entered into the search input bar. If I click the search button without entering any text, it lists everything within the book that was saved in local storage. I need both. Any advise?

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

More Detail on using the select menu

Hi,

In this case you need to combine conditions with "$and" or "$or" clause(depends on logic you need).

Please read more about it here: http://devcenter.appery.io/documentat...

Regards.

eascards
Posts: 0
Joined: Mon Jul 14, 2014 2:42 am

More Detail on using the select menu

I believe I would need $and but I'm afraid I don't understand the description. This is the code that is shown:
curl -X GET
-H "X-Appery-Database-Id: 526fdbd8e4b07c3286b537f1"
-G --data-urlencode 'where={"$and": [{"priority": "Low"},{"taskName": "Check email"}]}'
https://api.appery.io/1/db/collection...

That is nothing like what I have so I am having trouble matching my app with this one to make the required changes. Since it is so different, I feel like I am going to mess it up.

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

More Detail on using the select menu

Just add to your "whereObject" "$and" clause like:

pre

var whereObject = {$and: [ "Book": value, "someOtherField" : "otherValue" ] };
return JSON.stringify(whereObject);

/pre

Regards.

eascards
Posts: 0
Joined: Mon Jul 14, 2014 2:42 am

More Detail on using the select menu

If I do it like this, there are a bunch of errors? Image

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

More Detail on using the select menu

Hello Eascards,

You don't correcctly set the query. It should look something like this
pre{"$and": [{"priority": "Low"},{"taskName": "Check email"}]}/pre
i.e. in the array must be objects.

eascards
Posts: 0
Joined: Mon Jul 14, 2014 2:42 am

More Detail on using the select menu

I don't know what all of that means to try to make the changes in accordance to my app.

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

More Detail on using the select menu

Hi Escards,

Please use this code instead of wrong one:

pre

var whereObject = {$and: [ {"Book": value}, {"someOtherField" : "otherValue"} ] };
return JSON.stringify(whereObject);

/pre

Regards.

Return to “Issues”