locked
How I pass the value of a parameter of a query to a local parameter of a screen? RRS feed

  • Question

  • Hi all
    I created a query over an entity to which I added a parameter, MyNumber Integer = 32121, I create a Details screen over query, the screen is now added the local property of the parameter but when run show value = 0.
    Then, How I pass the value of a parameter of a query to a screen?
    Jaime

    • Edited by JaimeH Thursday, June 30, 2011 8:30 PM
    Thursday, June 30, 2011 3:49 PM

Answers

  • Right, so you're asking how to *get* the result of a query, in this case the "count", to be able to display it in a screen? And you want to pass the parameter value *to* the query.

    How about:

            Private Sub DetailScreen_Created()
                Me.ScreenPropertyName = _
    		Me.DataWorkspace.ApplicationData.QueryName(Me.Application.Current.User.Name).Execute.Count
            End Sub
    

    Just be aware that LS is going to pull all the records down to the client before it can calculate the count. Hopefully a better method will be provided in a future version.


    Yann

    (plus ça change, plus c'est la même chose!)

    • Marked as answer by JaimeH Friday, July 1, 2011 1:24 AM
    Friday, July 1, 2011 1:03 AM

All replies

  • You don't pass the value of the parameter *to a screen*, you pass a screen value *to the query's parameter*, by binding it to a screen value.

    • Use "Add Data Item", if the query is not already on the screen.
    • Expand the query & you'll see your parameter under a heading of "Query Parameters".
    • Click on the parameter, & in the properties pane you'll see a "Parameter Binding" box. 
    • Now you link whatever's appropriate from the screen properties (including sub-properties), that then gets passed *into* the query's parameter.

    Does that make sense?


    Yann

    (plus ça change, plus c'est la même chose!)

    Thursday, June 30, 2011 4:08 PM
  • Thanks for your reply Yann

    But this does not resolve the question.

    The idea is to present a screen set up on a query, a value established from the same query. How is this done?

     

    Jaime

     

    Thursday, June 30, 2011 4:28 PM
  • Sorry, if my answer doesn't help you see that it can't be done that way, then I don't understand your scenario.

    Yann

    (plus ça change, plus c'est la même chose!)

    Thursday, June 30, 2011 11:04 PM
  • Yann quiet, probably I could not explain properly. 
    What I'm trying to do is the following: Someone ask show to display the total number of records in a table as part of a screen with a data grid but with paging enabled, This prevents the screen within the code can be calculated and presented it will always be linked to the record number to display per page.
    Thus, I find that in a query I can calculate the total number of records and place it in a parameter query.
    Now, what I'm trying is to transfer that value to a local ownership within the screen for presentation. That's the point.
    Jaime
    Thursday, June 30, 2011 11:44 PM
  • Right, so you're asking how to *get* the result of a query, in this case the "count", to be able to display it in a screen? And you want to pass the parameter value *to* the query.

    How about:

            Private Sub DetailScreen_Created()
                Me.ScreenPropertyName = _
    		Me.DataWorkspace.ApplicationData.QueryName(Me.Application.Current.User.Name).Execute.Count
            End Sub
    

    Just be aware that LS is going to pull all the records down to the client before it can calculate the count. Hopefully a better method will be provided in a future version.


    Yann

    (plus ça change, plus c'est la même chose!)

    • Marked as answer by JaimeH Friday, July 1, 2011 1:24 AM
    Friday, July 1, 2011 1:03 AM
  • Thanks Yann

    It is solution.

     

    Jaime

    Friday, July 1, 2011 1:24 AM
  • You're welcome!

    Yann

    (plus ça change, plus c'est la même chose!)

    Friday, July 1, 2011 2:01 AM