locked
LightSwitch 2013 - Interactive filter for Open, Closed, All jobs RRS feed

  • Question

  • Hi Guys

    I'm building my first Lightswitch 2013 app (desktop only) for an enterprise job management application. I have a search jobs screen, that currently shows all jobs for the project. I also have a query for open jobs. I need to allow the user to select all jobs or open jobs only (maybe closed jobs only too). Ideally, I like something in the command bar. I could live with a button that toggles between Open jobs/All jobs or a check box that says "Open Jobs Only" (or "All jobs")

    I thought about using a parameter, but I read that a screen with a param doesn't appear in the list of screens to select, so I can't use that if the user can't select it. My next thought was to use code to change the Query from AllJobs to OpenJobs based on the user selecting something or clicking a button.

    Can someone point me in the right direction?

    Thanks

    Mark


    Mark

    Monday, March 17, 2014 2:18 PM

Answers

  • Hi

    You can use a Boolean (not required).

    In the choicelist:

    True = open jobs

    False = Closed jobs

    Null = All (This one cannot be in the choicelist and it will be empty in the choicelist on the screen)

    Make the Boolean as a parameter and on the screen it will be a drop down instead of a checkbox.

    Good luck

    Sven


    Sven Elm

    • Marked as answer by Angie Xu Monday, March 24, 2014 1:28 AM
    Tuesday, March 18, 2014 2:09 PM
  • Hi Mark,

    I am not sure if I have understood you well. If you just want to display the jobs as open only, there are two available ways for your try:

    • use the search bar at top right

          

          You can enter "Open" or any other words you used to clarify the job as open in the search bar. Then the screen  will display the data according to the searching conditions.

    • filtering data with queries

          In this way, you way create queries to filter the data which you want to display.

          You may refer to the link below:

    Beginning LightSwitch in VS 2013 Part 4: Too much information! Sorting and Filtering Data with Queries

    http://blogs.msdn.com/b/bethmassi/archive/2013/11/27/beginning-lightswitch-in-vs-2013-part-4-too-much-information-sorting-and-filtering-data-with-queries.aspx

    Hope it helps.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Xpert360 Tuesday, March 18, 2014 9:00 AM
    • Marked as answer by Angie Xu Monday, March 24, 2014 1:28 AM
    Tuesday, March 18, 2014 8:58 AM

All replies

  • Hi Mark,

    I am not sure if I have understood you well. If you just want to display the jobs as open only, there are two available ways for your try:

    • use the search bar at top right

          

          You can enter "Open" or any other words you used to clarify the job as open in the search bar. Then the screen  will display the data according to the searching conditions.

    • filtering data with queries

          In this way, you way create queries to filter the data which you want to display.

          You may refer to the link below:

    Beginning LightSwitch in VS 2013 Part 4: Too much information! Sorting and Filtering Data with Queries

    http://blogs.msdn.com/b/bethmassi/archive/2013/11/27/beginning-lightswitch-in-vs-2013-part-4-too-much-information-sorting-and-filtering-data-with-queries.aspx

    Hope it helps.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Xpert360 Tuesday, March 18, 2014 9:00 AM
    • Marked as answer by Angie Xu Monday, March 24, 2014 1:28 AM
    Tuesday, March 18, 2014 8:58 AM
  • Hi

    You can use a Boolean (not required).

    In the choicelist:

    True = open jobs

    False = Closed jobs

    Null = All (This one cannot be in the choicelist and it will be empty in the choicelist on the screen)

    Make the Boolean as a parameter and on the screen it will be a drop down instead of a checkbox.

    Good luck

    Sven


    Sven Elm

    • Marked as answer by Angie Xu Monday, March 24, 2014 1:28 AM
    Tuesday, March 18, 2014 2:09 PM
  • or you can set string parameter, but then in preprocess query you have to setup what you need..

    so you have string parameter "Jobs", and then in preprocess query:

    if Jobs = "1" then query = query. where(function(x) x.....) 'open jobs

    elseif Jobs = "2" then query = query.where(function (x) x....) 'closed jobs

    everything else is bypassed and shows all records..

    you can also setup choice list from screen property which is used for query parameter, so you can have nice dropdown with possible choices.. hth.. 

    Kivito


    Nobody expects the Spanish Inquisition! (M.P.F.C.)


    • Edited by Kivito Tuesday, March 18, 2014 3:51 PM
    Tuesday, March 18, 2014 3:39 PM