locked
LS 2012 Html Client: Using Queries for related items on a screen rather than the base table query? RRS feed

  • Question

  • Hello,

    When a screen is created by the Designer, and the screen has related entities:

    For example,

    A Order has a customer

    By default, the Designer uses the base table as the source of data for the customers, which will appear in a Modal Picker.

    If I want the list to be sorted in a particular way, I have to edit the Customers query on the screen.  Tedious...

    I have a SortedCustomers query that sorts the customers properly.  How can I tell the modal customer picker to use my SortedCustomers query?

    Thanks,

    Mike

    Wednesday, August 14, 2013 12:54 AM

Answers

  • You have to create a Query (serverside), preprocessquery and then add the Query to screen and the Point the modalpicker or autocomplete to that Query under "choice".

    I can help you out more if you like...

    Regards

    Sven


    Sven Elm

    • Marked as answer by A Bit of Help Wednesday, August 14, 2013 6:41 PM
    Wednesday, August 14, 2013 4:19 PM
  • Hi

    You have to bind it to to the parent table (Customer)

    In the screen (to the left) you see your ordersorted. Click on edit query

    Then add a parameter to customer

    For next step see next post, because you can add only two images.

    Sven


    Sven Elm


    • Edited by Sven Elm Wednesday, August 14, 2013 9:16 PM
    • Marked as answer by A Bit of Help Wednesday, August 14, 2013 9:26 PM
    Wednesday, August 14, 2013 9:02 PM
  • Step 3

    Bind that parameter (ignore my bindning names in my images, I'm from sweden ;)) to customer Id in parent (customers)

    And on the left (Properties)

    Write the binding like

    It should be in your binding: customers.id

    No save and F5 your sorted table should show the related orders to selected customer.

    regards

    Sven

    Ps Hope you got that!


    Sven Elm

    • Marked as answer by A Bit of Help Wednesday, August 14, 2013 9:25 PM
    Wednesday, August 14, 2013 9:13 PM
  • Hi

    You have to bind it to to the parent table (Customer)

    In the screen (to the left) you see your ordersorted. Klick on edit query

    Then add a parameter to customer

    For next step see next post, because you can add only to images.

    Sven


    Sven Elm


    Your binding should be in query designer Customer.id (or something) ;)

    Sven Elm

    • Marked as answer by A Bit of Help Wednesday, August 14, 2013 9:26 PM
    Wednesday, August 14, 2013 9:14 PM

All replies

  • You have to create a Query (serverside), preprocessquery and then add the Query to screen and the Point the modalpicker or autocomplete to that Query under "choice".

    I can help you out more if you like...

    Regards

    Sven


    Sven Elm

    • Marked as answer by A Bit of Help Wednesday, August 14, 2013 6:41 PM
    Wednesday, August 14, 2013 4:19 PM
  • Awesome, Sven!  Your solution works perfectly!  Thank you for your help! :)

    Mike

    Wednesday, August 14, 2013 6:41 PM
  • Happy for you,

    Remember that you can reuse the Query now in many screens!

    Good luck and keep posting questions about LS. I have done this since the beginning and am glad to share....

    Good luck

    Sven


    Sven Elm

    Wednesday, August 14, 2013 7:31 PM
  • Hi Sven,

    I have a related question that I hope that you can help me with... 

    LS generated a ViewCustomer screen.  On the screen, there is a tab to see the customer's orders.  LS is using the table and not a sorted query that I've created for orders.  How can I change the tab that shows the orders so it uses my OrdersSorted query? 

    Here is what I've tried...

    1) Added the OrdersSorted query to the screen through the Add Data Item button.
    2) I dragged te OrdersSorted query to the tab where the original list of orders is displayed, so I can see what it displays.
    3) I launched the application and went to ViewCustomer.  When I click on the Orders tab, I see a list of all of the Orders for all Customers, sorted.  Below that list, I see the orders that are related to the particular customer that I am viewing.  So, it appears that my OrdersSorted is not filtering its contents to display only the sorted orders for the customer that I am viewing.  Is there an easy way to make this work?
     The Rows Layout for my sorted list has the following binding:

    OrdersSorted(item)

    The Rows Layout for the original, unsorted list has the following binding:

    Orders(item)

    I'd appreciate your suggestions,

    Thanks,
    Mike


    Wednesday, August 14, 2013 8:37 PM
  • Hi

    You have to bind it to to the parent table (Customer)

    In the screen (to the left) you see your ordersorted. Click on edit query

    Then add a parameter to customer

    For next step see next post, because you can add only two images.

    Sven


    Sven Elm


    • Edited by Sven Elm Wednesday, August 14, 2013 9:16 PM
    • Marked as answer by A Bit of Help Wednesday, August 14, 2013 9:26 PM
    Wednesday, August 14, 2013 9:02 PM
  • Step 3

    Bind that parameter (ignore my bindning names in my images, I'm from sweden ;)) to customer Id in parent (customers)

    And on the left (Properties)

    Write the binding like

    It should be in your binding: customers.id

    No save and F5 your sorted table should show the related orders to selected customer.

    regards

    Sven

    Ps Hope you got that!


    Sven Elm

    • Marked as answer by A Bit of Help Wednesday, August 14, 2013 9:25 PM
    Wednesday, August 14, 2013 9:13 PM
  • Hi

    You have to bind it to to the parent table (Customer)

    In the screen (to the left) you see your ordersorted. Klick on edit query

    Then add a parameter to customer

    For next step see next post, because you can add only to images.

    Sven


    Sven Elm


    Your binding should be in query designer Customer.id (or something) ;)

    Sven Elm

    • Marked as answer by A Bit of Help Wednesday, August 14, 2013 9:26 PM
    Wednesday, August 14, 2013 9:14 PM
  • Hi Sven,

    I've been wrestling with the following issue for 3-days.  If you have a moment, could you please let me know if you have any suggestions?

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/02780817-ad94-4b2a-abd1-565a3039bab8/ls-2012-html-client-odata-kendoui-combobox-works-except-for-persisting-changes-please-help

    Thanks for your time!

    Mike

    Tuesday, August 20, 2013 6:42 PM