Refreshing Crosstab in the same report from and editable list

(5 posts) (2 voices)

Tags:

No tags yet.

  1. haigda, Member

    This is probably quite simply but I can't find out how in the documentation or forums

    I have an editable report as a list where the last column is editable (a character field). Under this I have two crosstabs, one for the overall totals from the list and one for the totals of those records which have been 'ticked off' in the character field.

    It all displays fine at the start, but when I edit the character field the 'ticked off' crosstab doesn't update. I have set up the report in one file - code below. Is this the right way to do it? Should the crosstabs be separate procedures and therefore calls? If so, how do I keep them in the design?

    Any help greatly appreciated as I'm new to myDBR.

    Cheers,
    David

    DROP PROCEDURE IF EXISTS sp_DBR_Cashbatch
    $$
    CREATE PROCEDURE sp_DBR_Cashbatch()
    BEGIN

    /* select 'dbr.report', 'sp_DBR_editbatchno'; */
    select 'dbr.embed_object','shared_embed';
    select 'dbr.editable', 'Batch Ref', 'sp_DBR_editbatchno', 'inOrderID=Order ID', 'inDate=Date', "Options={'callback':autosum_float}";

    select 'dbr.sum',3,4;

    select d.OrderID as 'Order ID',
    d.PmtDateTime as 'Date',
    sum(d.PmtAmount) as 'Amount',
    sum(d.PmtCardCharge) as 'Card Charges',
    d.PmtDescription as 'Description',
    d.PmtType as 'Type',
    d.T28Auth as 'Authorisation',
    d.PmtBatch as 'Batch Ref'
    from dt_travel.dt_payment d
    group by d.OrderID, d.PmtDateTime, d.PmtDescription, d.PmtType, d.T28Auth, d.PmtBatch;

    select 'dbr.crosstab', 'Type';
    select 'dbr.subtitle', 'Current Batched Totals';
    /* select 'dbr.sum', 'Amount','Card Charges', 'Overall'; */

    select d.PmtType as 'Type',
    sum(d.PmtAmount) as 'Amount',
    sum(d.PmtCardCharge) as 'Card Charges',
    sum(d.PmtAmount+d.PmtCardCharge) as 'Overall',
    count(d.PmtAmount) as 'No of Items'
    from dt_travel.dt_payment d where d.pmtBatch is not null
    group by d.PmtType;

    select 'dbr.crosstab', 'Type';
    select 'dbr.subtitle', 'Overall Batch Totals';
    /* select 'dbr.sum', 'Amount','Card Charges', 'Overall'; */

    select d.PmtType as 'Type',
    sum(d.PmtAmount) as 'Amount',
    sum(d.PmtCardCharge) as 'Card Charges',
    sum(d.PmtAmount+d.PmtCardCharge) as 'Overall',
    count(d.PmtAmount) as 'No of Items'
    from dt_travel.dt_payment d
    group by d.PmtType;

    END
    $$

  2. myDBR Team, Key Master

    Hi,
    report elements are independent from each other, therefore as the the 'autosum_float' has been attached to the first report element, it has no effect on other elements.

    If you wish to update the other elements based on actions on the fisrt one, you can divide the report in two. The main report would produce the editable list, while another, a linked report would produce the summaries. You can invoke the summary report by attaching it behind a hidden button and clicking the button with javaScript. Similarily, you can click the button from the callback-function when user edits the value.

    Btw, if you just use the editing to 'tick on/off', you can use dbr.report with 'onlick' instead of dbr.editable. Will be more convenient for the user.
    --
    myDBR Team

  3. haigda, Member

    Many thanks for your prompt response, and I was trying the autosum option in case that worked.

    I am a little hazy on how to get the second report positioned on a page as a linked report - is there a demo of that I could have a look at?

    I was also looking at the 'yes / no' toggle on Editable Report - Editing Example 3 to use here but the 'source code' is missing for the main report, just the functions / procedures are there. I'd like to see how you call it and embed the 'button'

    Cheers,
    David

  4. myDBR Team, Key Master

    David,
    take a look at a demo here.

    Added the Editing Example 3 source code to the demo. Thanks for pointing that out.

    --
    myDBR Team

  5. haigda, Member

    Brilliant,

    Thank you


Reply

You must log in to post.