Show select list and button in report header

(8 posts) (2 voices)

Tags:

No tags yet.

  1. Steve44, Member

    I have created the report below and it is almost doing what I want, but not quite. I have a header section at the top of the report with a title, some text, a button, and an drop-down (select) list. I show a series of query results in the body below the header section at the top beginning with the loan table. I want to be able to display a popup window when the user selects a table name from the selectlist AND presses the button. Currently the popup list appears when the user selects an item from the selectlist and the button does not appear. Can I modify this report so that the popup does not appear when the user selects an item from the drop-down list, but instead appears when they click the button? Also, why doesn't the button appear? And for extra credit, can I have the select list have no selection when the report first appears, or even better an option that says "Select A Table". I don't know how I was able to get this far because the selectlist/report behavior is not well-explained (to me) in the documentation. It appears that the selectlist takes the values from the first column in sp_DBR_payasr_Show_Table, but I'm not sure.

    CREATE PROCEDURE sp_DBR_Loan_Viewer( LoanID INT ) BEGIN

    SELECT 'dbr.title', 'Loan Viewer'; SELECT 'dbr.text', CONCAT('Loan ID ', LoanID), 'ParamHeaderClass';

    SELECT 'dbr.report', 'sp_DBR_payasr_Show_Table', 'popup', 'TableName=table_name'; SELECT 'dbr.button', 'Show Table'; SELECT 'dbr.selectlist', '', 'Select'; SELECT table_name FROM payasr.show_table ORDER BY table_name;

    SELECT 'dbr.text', 'loan', 'ParamHeaderClass';

    SELECT * FROM payasr.loan WHERE id = LoanID;

    SELECT 'dbr.text', 'adjustment_log', 'ParamHeaderClass';

    SELECT * FROM payasr.adjustment_log WHERE loan_id = LoanID ORDER BY adjustment_dt;

    SELECT 'dbr.text', 'loan_term', 'ParamHeaderClass';

    SELECT * FROM payasr.loan_term WHERE loan_id = LoanID ORDER BY effective_dt;

    SELECT 'dbr.text', 'loan_payment_method', 'ParamHeaderClass';

    SELECT * FROM payasr.loan_payment_method WHERE loan_id = LoanID ORDER BY effective_dt;

    END $$

  2. myDBR Team, Key Master

    When you have a resultset, like you have in the report:

    "SELECT table_name FROM payasr.show_table ORDER BY table_name;"

    You can then attach a linked in report to it using dbr.reprot. If you do not define anything else, the resultset will be displayed as a table showing all columns in the query and the linked report is attached to each row. You can also show the result set in another form: a chart (dbr.chart), a button (dbr.button), a selectlist (dbr.selectlist) etc.

    You have for your resultset defined both a button and a selectlist, myDBR just chooses to use the selectlist.

    --
    myDBR Team

  3. Steve44, Member

    Thanks, but is there any way to show the selectlist and make it respond to a button click instead of displaying on the select event? If not, is there a way for me to make the selectlist not select anything at start because it is selecting the first choice in the list. If I want to see that choice first I need to select a different choice, then select the first item again.

    Steve

  4. myDBR Team, Key Master

    You would have to unbind the default change action from the selectlist and then create a button which would execute the selection. That would be something like this:

    select 'dbr.javascript',"$('.mydbrselectlist').unbind('change');", 'onload';
    select 'dbr.html', '<input class="button" type="button" value="Select" onclick="window.location.href = $(''.mydbrselectlist'').val();">';

    --
    myDBR Team

  5. Steve44, Member

    I'm impressed. That solution worked perfectly. I have another request, if it can be done. The Select button appears below the drop-down list and there appears to be a blank row between them. Can that code be modified to place the Select button on the same row, immediately after the drop-down list?

  6. myDBR Team, Key Master

    Sure,
    just put "select 'dbr.keepwithnext';" before the selectlist and if you like, adjust the top padding of the selectlist to align the elements horizontally. You would also need to add break after the Select-button.

    --
    myDBR Team

  7. Steve44, Member

    Thanks. That works. The alignment is off a bit. Can you direct me to somewhere in the documents that describes how I adjust things like the padding?

  8. myDBR Team, Key Master

    Steve,
    easiest way to do it, is to do something like:

    select 'dbr.css', '.mydbr_selectlist {margin-top:5px}';

    Different browsers might adjust the elements bit differently so you might want to try out the best result for you.

    --
    myDBR Team


Reply

You must log in to post.