Dynamic Default Parameters

(6 posts) (2 voices)
  1. tardis89, Member

    Is there a way to make the default parameters in the parameter queries to look at previous entries like you can with buttons and check boxes?

    For example, with the user inputs, I can have the next user input reference the previous user input to populate itself dynamically when the previous input changes. I need to be able to do this so that the default (which changes depending on the previous selection) can be done.

    I tried making a default similar to the inputs as shown below so that when I change locations, the next box with all the places listed in the next box is default checked (as opposed to having to press "check all", but it doesn't work:


    select ID from machines where Location = mydbr_param_prev1;

  2. myDBR Team, Key Master

    Not quite sure what you are trying to do: set a default (which is the default value when user first sees the parameter screen) or a set a connected parameter (where value of another parameter is changed when user changes the value of another parameter).

    if you are trying to set connected checkbox parameters, return the ID's in comma separated list.

    --
    myDBR Team

  3. tardis89, Member

    The default works for when it's first loaded. However, I want it to be dynamic so that when I select a different location, the next parameter updates for that location and default checks all. I can't get the default check all to work.

  4. myDBR Team, Key Master

    The dynamic one is called "connected parameters" in myDBR. To set checkbox values based on another selection, return a comma separated list of ID's.

    select "1,2,3,4" would check the respective ID's.

    --
    myDBR Team

  5. tardis89, Member

    Select "1,2,3,4" is static programming though. Is there a way to make it dynamic so that if the checkbox changes from "1,2,3,4" to "5,6,7,8" due to a mydbr_param_prev1 change, could the default be smart enough to do that and check all? I haven't found a way to do this.

  6. myDBR Team, Key Master

    The select "1,2,3,4" was just an example. What you would do is to write your own logic to return the ID's you want when the changes the other paramerter based on mydbr_param_prev1 (or better yet, use the parameter name in parameter query stored procedure).

    Say you have a report procedure as:

    sp_DBR_myreport ( inCompanyID int, inDivision int )
    begin
    ...
    end

    You can attach a parameter query like this to inDivision:

    sp_param_division ( inCompanyID int )
    begin

    select group_concat( division_id )
    from xxx
    where company_id = inCompanyID;

    end

    --
    myDBR Team


Reply

You must log in to post.