Searching a boolean column in LightSwitch App
The default search box in a LightSwitch screen is very neat - all set up for you and it searches almost everyth开发者_如何学Going. But is there a way to filter the result set on a boolean column? Or more than one boolean column? Is there an advanced search syntax, or is it just a super simple search for strings? Maybe I missed something in the documentation?
Note I'm using the first beta.
One way is to create your Search Data Screen and press the "Edit Query" next to the TaskCollection, on the left column. Enter your boolean constraints and save. Your screen will be 'filtered' before being displayed.
Another way is to create a new query from your entity and base the new screen on it. Select an entity and choose "Query" from its Title/Add bar. Name your query and enter your boolean constraints. Choose "Add Screen" from this query's Title bar and create your Search Data Screen.
The latter may be useful if you want to re-use your boolean constraints.
Did you try using a Query with a parameter?
Bind that parameter to a boolean property on your screen. Then add the boolean property as a check box on your field layout.
(I am assuming here that searches run against a query)
The built-in search isn't customisable (& only searches on string properties in V1).
The way to do what you want is, as the other responders have indicated, to turn off the built-in search (click the screen query property & untick "Support Search") & to use a parametrised query.
Here are a couple of links that might help:
http://blogs.msdn.com/b/bethmassi/archive/2010/11/09/creating-a-custom-search-screen-in-visual-studio-lightswitch.aspx
http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/5777350b-0e39-488c-ae52-c8e6e4eefea7
Yann
精彩评论