locked
Change Lightswitch datasource to Query of table instead of the whole table RRS feed

  • Question

  • I have a number of screens which are working to plan - with a select of a customer list as one of the options.  However, instead of being presented with ALL of the customers, I would like the screen to present a filtered version based on a single column filter.  I am struggling to get the AddEdit screen to show the query of the datasource I have done, as it is simply showing the whole table instead.

    Is there a quick way to change the screen to show the filtered table instead of the whole table or must I remake the screen from scratch?

    Help is appreciated as usual.

    Thank you.

    Thursday, August 20, 2015 12:05 PM

Answers

  • In the properties windows for a details picker you have a property 'Choices'. When you have added your filtered query on the left as a screen collection, you should assign it to 'Choices'.

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by R.T. Watkins Thursday, August 20, 2015 3:13 PM
    • Marked as answer by Angie Xu Friday, August 28, 2015 2:37 AM
    Thursday, August 20, 2015 3:10 PM
  • Oh, I misunderstood what you're asking for.  If you want a filtered query to be the source for a Details picker, and you already have a picker from the unfiltered related table on the screen, you should just be able to change the Source of the picker from the table to your query on its Properties tab.
     (EDIT: "Choices" is the correct property to change.)
    • Edited by R.T. Watkins Thursday, August 20, 2015 3:12 PM corrected property name
    • Marked as answer by sven texas Friday, August 28, 2015 11:45 PM
    Thursday, August 20, 2015 3:11 PM

All replies

  • Either create a new screen based on your query instead of on its table, or filter the table used on the screen by clicking "Edit Query" next to the table name on the screen.  You may need to add some screen Data Items if your query parameters are unknown when the screen is first called.
    Thursday, August 20, 2015 12:38 PM
  • Thanks R.T for the prompt reply.  I cannot seem to get the queried data to be recognised inside an add/edit screen as the base data.  It appears for a browse table but not the add edit.

    If I add the data to the far left block (left of the design tree) and drag it onto the tree I can't seem to get it as part of a details picker - just a list option, which is a bit of a shame.

    Can you shed any light on this for me?  Thanks a lot, Sven.

    Oh and by the way you offered some advice around the tables being visible once deployed - worked like a charm!

    Thursday, August 20, 2015 2:33 PM
  • In the properties windows for a details picker you have a property 'Choices'. When you have added your filtered query on the left as a screen collection, you should assign it to 'Choices'.

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by R.T. Watkins Thursday, August 20, 2015 3:13 PM
    • Marked as answer by Angie Xu Friday, August 28, 2015 2:37 AM
    Thursday, August 20, 2015 3:10 PM
  • Oh, I misunderstood what you're asking for.  If you want a filtered query to be the source for a Details picker, and you already have a picker from the unfiltered related table on the screen, you should just be able to change the Source of the picker from the table to your query on its Properties tab.
     (EDIT: "Choices" is the correct property to change.)
    • Edited by R.T. Watkins Thursday, August 20, 2015 3:12 PM corrected property name
    • Marked as answer by sven texas Friday, August 28, 2015 11:45 PM
    Thursday, August 20, 2015 3:11 PM
  • Thankyou Xpert360 - I would never have got it, but as expected works a treat.  Thanks.
    Friday, August 21, 2015 12:33 PM
  • Thankyou R.T - I realise I should have made my question clearer - thankyou for your reply.  Cheers
    Friday, August 21, 2015 12:34 PM