When to use Flip Switch?
Flip Switch is one of the coolest feature in LightSwitch 2013. When you have requirement of querying the table on particular column at that time we can use Flip Switch.Let's for example, we have Order table and that table have orders which are Processed and Cancelled and we have requirement of showing those orders on Switch control, so in that case we need to design Query on Order table as follows;
Add new browse screen and select screen data as OrderSearchQuery as follows;
After creating new screen, in the editor mode we get following options for added parameters in the query mode for Processed and Cancelled. Drag and drop both the parameter on the screen layout and change control type from Text to Flip Switch as follows;
So you can see in above screen shot we have changed control type for 'Cancelled' from text to flip switch.
Now coming to query part - How to write query on the Flip Switch control?
- Its simple, just goto the OrderSearchQuery.lsml file in Server project and on the right hand upper corner you can see < >Write Code -> General Methods -> OrderSearchQuery_PreprocessQuery link. Just click on the 'OrderSearchQuery_PreprocessQuery' link and following method will get open in MyDBDataService.cs class file;
Add business logic for the Processed and Cancelled flip switch as follows and your application is ready to run.
No comments:
Post a Comment