[editable report] Reload a part of report

(17 posts) (2 voices)

Tags:

No tags yet.

  1. TrungNS, Member

    I have a report that contain 2 parts

    1. Load a 2 table data from database by calling stored procedure
    call fap_woi.MyDBR_LoadData1(); --> table 1
    call fap_woi.MyDBR_LoadData2(); --> table 2

    2. Load an input grid form that let user input data. The requirement that when user input data, the report refresh only table 1.

    Currently I have to refresh all page by using callback

    elect 'dbr.javascript', 'function reload_callback()
    {
    location.reload();
    }';

    select 'dbr.editable', 'Qty', 'sp_DBR_inputSellInForecast', 'ItemDataTypeID="0"', 'DealerID="10"', 'ItemID=ItemID', 'TimeStampID=Week', 'Qty=Qty', "options={'callback':reload_callback}";

    How can I refresh only table 1?

    Thank

  2. myDBR Team, Key Master

    Hi,
    In order to make a part of a report independently refreshable, you need to make that part target for an embedded report (this will allow myDBR to use Ajax to populate that part of the report).

    To do so, create an embed_object and populate it with a report call at startup. You can then refresh it by executing the embedded report call via the same click in the callback.

    select 'dbr.report', 'sp_DBR_load_data_1', 'load1_result';
    select 'dbr.button', '', 'invisible load1';
    select ''; select 'dbr.embed_object', 'load1_result'; call fap_woi.MyDBR_LoadData2(); select 'dbr.javascript', "$('.load1')[0].click()", 'onload';

    --
    myDBR Team

  3. TrungNS, Member

    Thank you for your help

    I was able to load the embed object load1_relsult. However, for the call back function I did call to the button click but still no luck. could you please help me

    select 'dbr.javascript', 'function reload_callback()
    {
    $( "load1" ).click();
    }';

  4. myDBR Team, Key Master

    Use the same syntax as in the main refresh:

    $('.load1')[0].click()

    (jQuery does not pass click to a-tags)

    --
    myDBR Team

  5. TrungNS, Member

    Hi team

    I have change the call back function however, we can not execute the report. It seem to be a syntax error. Please help me.

    select 'dbr.javascript', 'function reload_callback()
    {
    $('.load1')[0].click();
    }';

  6. TrungNS, Member

    I have changed as below and it works.
    Thank you for your help

    select 'dbr.javascript', "function reload_callback()
    {
    $('.load1')[0].click();
    }";

  7. TrungNS, Member

    Dear Team

    In the editable report. I have a Summary row such as

    select 'dbr.sum', '[Qty]';

    I need to recalculate this Qty also. I have followed the Demo version as below

    select 'dbr.javascript', "function reload_callback()
    {
    autosum_int(this);
    $('.load1')[0].click();

    }";

    However, only the load1 is reloaded. The report did not recalculated the summary amount.
    Could you please help me to give some advice?

    Trung

  8. myDBR Team, Key Master

    if you just edit a column you do not need to reload the object. Nor do you have to create a custom callback function. Just use call the editable with option call predefined callback.

    select 'dbr.editable', 'Qty', 'sp_DBR_edit', 'id=id', "options={'callback':autosum_int}";

    --
    myDBR Team

  9. TrungNS, Member

    Dear team

    I need to both reload the object and recalculate the sum Qty. Please advice how does this work?

    In the call fap_woi.MyDBR_LoadData2(); --> table 2. I used group by condition

    Group By column A, column B, column C

    however, the autosum_int only recalculate the summary of the first group A. when I edit the value from group B, C the editable did not recalculate the summary Qty

  10. myDBR Team, Key Master

    If you reload the object, the recalculation is done automatically if you put the command:

    select 'dbr.sum', 'Qty';

    in the procedure doing the reload. This way you keep everything that belongs to that object in same place.

    --
    myDBR Team

  11. TrungNS, Member

    I have changed the reload procedure as below, however, it does not work. Please advice.

    select 'dbr.javascript', "function reload_callback()
    {
    $('.load1')[0].click();

    autosum_int(this);
    select 'dbr.sum', '[Qty]';

    }";

    I have a report that contain 2 parts

    1. Load a 2 table data from database by calling stored procedure
    call fap_woi.MyDBR_LoadData1(); --> table 1
    call fap_woi.MyDBR_LoadData2(); --> table 2

    2. Load an input grid form that let user input data. The requirement that when user input data, the report refresh only table 1.

    Currently I have to refresh all page by using callback

    elect 'dbr.javascript', 'function reload_callback()
    {
    $('.load1')[0].click();
    }';

    select 'dbr.editable', 'Qty', 'sp_DBR_inputSellInForecast', 'ItemDataTypeID="0"', 'DealerID="10"', 'ItemID=ItemID', 'TimeStampID=Week', 'Qty=Qty', "options={'callback':reload_callback}";

  12. myDBR Team, Key Master

    It is bit difficult to comment as we only see part of the report and do not see what your input grid actually looks like.

    The "select 'dbr.sum', '[Qty]';" command is a SQL command (not JavaScript code) and should be placed in the SQL procedure which loads the result set to which the 'Qty' refers to. If the command refers to a Qty column in table 1, place the command in fap_woi.MyDBR_LoadData1-procedure.

    The editable command has the Qty column twice unless you want to pass the original value as well. When you set a column to be editable (in your case the Qty-column), the edited value is already automatically added as parameter to editing procedure (sp_DBR_inputSellInForecast).

    --
    myDBR Team

  13. TrungNS, Member

    Dear Team

    I may have found the root cause is not by the loading process, it seemed to be caused by the group command. Please noted that we also use crosstab function

    I have removed all the Group command
    ======================================
    select 'dbr.sum', '[Qty]';
    select 'dbr.crosstab', 'Week';
    select 'dbr.editable', 'Qty', 'sp_DBR_inputSellInForecast', 'ItemDataTypeID="0"', 'DealerID="10"', 'ItemID=ItemID', 'TimeStampID=Week', 'Qty=Qty', "options={'callback':autosum_int}";

    Select Column A, Column B, Column C, Column D, Column E, (Qty) Qty
    FROM Table 1

    It calculated the summary when I changed values. However, When I add 2 more Group column. It only recalculated the summary value at the Group A.

    Select Column A, Column B, Column C, Column D, Column E, SUM(Qty) Qty
    FROM Table 1
    Group By Column A, Column B, Column C, Column D, Column E

  14. TrungNS, Member

    I have noted that When I remove the group command, it works.

    select 'dbr.hdr', ' Column A'

    It seemed to be that there are something wrong with autosum_int when we use select 'dbr.hdr'.

  15. myDBR Team, Key Master

    Hi,
    autosum_int now supports different header levels. Run the updater to get the latest build.

    --
    myDBR Team

  16. TrungNS, Member

    Dear Team

    I have upgraded to myDBR 4.3.1 (build 2515). However it still does not work. Please advice.

  17. myDBR Team, Key Master

    OK,
    could you be more specific what does not work?

    If you have a Premium license, please open a support ticket and provide example code which does not work.

    --
    myDBR Team


Reply

You must log in to post.