Page 1 of 1

Boolean Filter assistance

Posted: Mon Mar 10, 2014 4:40 pm
by Tommy Thomas

Mapping a database collection to a list, I have a boolean field called "isActive" and I'd like to only display items in the list that are set to "isActive:true"

I'm assuming I do this in my mapping from the $ to the listitem. How's it written where I only return true items?

codereturn isActive(true);/code


Boolean Filter assistance

Posted: Mon Mar 10, 2014 5:13 pm
by Illya Stepanov

Hi Tommy -

Show us example of your DB structure.


Boolean Filter assistance

Posted: Mon Mar 10, 2014 5:19 pm
by Tommy Thomas

Boolean Filter assistance

Posted: Mon Mar 10, 2014 5:38 pm
by Tommy Thomas

I'm sure I just add it to the Edit JS button where the $ is associated with the listitems... Just don't know the small bit of code: return isActive = true;


Boolean Filter assistance

Posted: Mon Mar 10, 2014 5:47 pm
by Tommy Thomas

Maybe a "where isActive=true"


Boolean Filter assistance

Posted: Mon Mar 10, 2014 6:16 pm
by Illya Stepanov

What service your are calling?
Expression will look like this for testing service tab:
pre
where={"isActive": {"$exists":true}}
/pre


Boolean Filter assistance

Posted: Mon Mar 10, 2014 6:56 pm
by Tommy Thomas

I don't know, I just want to bring over the items that are marked "true" so basically list all items that have the column "isActive" set as 'true' and not list the ones marked as 'false'...


Boolean Filter assistance

Posted: Tue Mar 11, 2014 1:49 am
by Tommy Thomas

That code above did not work but I may be putting it in the wrong spot ...


Boolean Filter assistance

Posted: Tue Mar 11, 2014 2:14 pm
by Maryna Brodina

Hello! You don't need to add any JS mapping. You can just map from isActive field to listitem visible property.


Boolean Filter assistance

Posted: Tue Mar 11, 2014 2:47 pm
by Tommy Thomas

That's awesome! Thanks! I couldn't wait to try it and it worked. So easy... :)