How to filter parameters

(15 posts) (4 voices)
  1. stefx, Member

    Hi to all, I've 2 parameters on a report. The second parameters depend on the first parameter selection... How to made it?
    Thanks a lot
    Stefano

    Posted 7 years ago #
  2. myDBR Team, Key Master

    Parameters are independent of eachother, so you cannot link them at the moment.

    You can however connect them by using a linked report i.e. having a first report's parameter passed to another report.

    --
    myDBR Team

    Posted 7 years ago #
  3. bdhash, Blocked

    I am in a similar situation, a lot of my reports have dependent parameters. e.g. Report 1 - takes 2 parameters, CustomerName and TestResultsIDToIgnore. TestResultsIDToIgnore is dependent on the CustomerName (each Customer has his own set of TestResultIDs). A dependent parameter would be really helpful.

    I am curious if things have changed in the last one year since the last query was posted? Is there an direct, or probably indirect way to achieve this? I have extensively used linked reports and it is not sufficient.

    Regards,
    BD

    Posted 6 years ago #
  4. myDBR Team, Key Master

    No changes there. Linked reports is still the way to go.

    --
    myDBR Team

    Posted 6 years ago #
  5. bdhash, Blocked

    Well, in that case, can you suggest some way to achieve the following use-case:
    Step 1: User selects CustomerName
    Step 2: All the TestResultsID for the given CustomerName is fetched
    Step 3: User selects a subset of the TestResultsIDs (say s/he is only interested in 5 out of the 10 TestResultsIDs that have been fetched)
    Step 4: The selected list of TestResultsIDs are passed to another report for further processing (probably using a linked report)

    I have been breaking my head over this problem for half a day now but couldn't think of a way to achieve Step 3+Step 4 using myDBR

    This could potentially be achieved, if dependent parameters were supported, by passing the CustomerName to the "parameter query" (defined as a checkbox user input)

    Can you think of a way to fulfill this scenario? Am I missing something here?

    Regards,
    BD

    Posted 6 years ago #
  6. myDBR Team, Key Master

    Having the parameter checkbox list to be generated based on some other user input could be bit tricky. You would have to pass the CustomerName through some link table.

    We'll see if there is something we could do about the linked parameters while still maintaining the ease of use.

    --
    myDBR Team

    Posted 6 years ago #
  7. bdhash, Blocked

    thanks for looking into this, it would be really helpful.

    Regards,
    BD

    Posted 6 years ago #
  8. situ, Member

    I know this is an old post but did any progress get made on how to address this with regards to linked parameters?

    Is there any way of making one of several parameters mandatory, ie 6 parameters and you must select a value for at least one of them?

    Posted 4 years ago #
  9. myDBR Team, Key Master

    Linked parameters have been fully supported checkboxes since couple of major versions ago.

    If you have separate parameters, the logic of checking the parameters should be done in the report itself.

    --
    myDBR Team

    Posted 4 years ago #
  10. situ, Member

    What approach would you use to prompting a user to enter at least 1 of 4 parameters?

    Obviously I can check when they select Run Report but this is after the event, how do I then prompt them to enter 1 of 4 parameters?

    Is is a case of checking and re-executing the same report if the validation fails? Can we enter some guidance text on the parameters page?

    Ideally can we prevent moving past the parameters page until the validation is satisfied with some warnings?

    Thx in advance for quick responses, it is greatly appreciated.

    Posted 4 years ago #
  11. myDBR Team, Key Master

    Usually it is enough for a report just to prompt user to enter one of the values. If user does not do that you display an error when report is run and user goes back and fixes the input.

    If you want to check the paramerters before user is allowed to execute the report, you can add JavaScript check to the parameters (the help-field accepts JavaScript). To check first two parameters, do:

    <script>
    $('.param_input').submit(function() {
    if ($('#u1').val()=='' && $('#u2').val()=='') {
    alert('Enter at least one of the parameters.');
    return false;
    }
    });
    </script>

    --
    myDBR Team

    Posted 4 years ago #
  12. situ, Member

    The java script sounds exactly what I need unfortunately I was unable to get it to work.

    I have copied the above example into the "Help" text area in the Edit Report page, I presume that is the correct help area. When I execute the report I have 6 parameters and if I leave the first two empty, no notification is provided.

    I do see however a new text area underneath the report title and before the parameters, this was never there before.

    The parameter queries for the first two fields are both setup in a similar way to the following
    SELECT null,'All' union select id,TAXVALDESC from sipo_db.tm_m_ibm_taxdtls where type_id=3 and state_id=1;

    The parameters are popup field and are defined as optional. The report type is HTML. No default value has been set.

    I'm I am probably misunderstanding something.

    thanks Simon

    Posted 4 years ago #
  13. myDBR Team, Key Master

    The script checks if parameters (referred as u1, u2...) are empty or not. If all parameters listed are empty, the script shows an alert and cancels the form submit process. You can check any script you use in browser's debugger.

    If you are using popup fields, they always contain value (except in your case where you use NULL for 'All'). When you are using popup and say "I leave the first two empty" what does it mean? What is seen as popup value.

    The extra text area underneath the report title, is removed from latest builds if no help text is provided.

    --
    myDBR Team

    Posted 4 years ago #
  14. situ, Member

    I've tried some more and still cannot get it to work.

    When you refer to u1 and u2, are they internal parameter names and should they be replaced with my own parameter names? I have tried both solution with no success.

    Is it possible that my parameter query is not being interpreted as empty. The parameter queries pull an id and a description, the description is display in the popup and the id is passed to the query. When I want to leave something undefined I select "All" from the popup which passes null as the id to the query. Is this being interpreted as not empty?

    My test is that I have 6 parameters on the filter screen, I am expecting if I set the first 2 as 'All" (id of NULL) the warning comes up.

    It will be great when it works :-)

    Posted 4 years ago #
  15. myDBR Team, Key Master

    if your parameters are popups (select), get value of first parameter using jQuery like this:

    <script>
    $('.param_input').submit(function() {
    if ($('select[name="u1"]').val()=='' && $('select[name="u1"]').val()=='') {
    alert('Enter at least one of the parameters.');
    return false;
    }
    });
    </script>

    u1 will refer to first parameter and is myDBR's internal form field's name.

    You can try it out in your browser's debugger window.

    --
    myDBR Team

    Posted 4 years ago #

Reply

You must log in to post.