In place editable report not working

(6 posts) (2 voices)

Tags:

No tags yet.

  1. Nithin, Member

    Hi,

    I've written a basic in place editable report and its not working. Below is the code, any pointers at the mistake would be very helpful

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

    select 'dbr.editable', 'ParentCampaignID', 'sp_DBR_update_parentCampaign', 'inParentCampaign=ParentCampaignID', 'inCmpId=CampaignID', "select=select campaignId as ID, campaignId from database.mobc_campaigns";

    select campaignId as 'CampaignID', campaignName as 'CampaignName', isDuplicate as 'IsDuplicate', parentCampaignId as 'ParentCampaignID'
    from database.mobc_campaigns;

    END
    $$

    DROP PROCEDURE IF EXISTS sp_DBR_update_parentCampaign
    $$
    CREATE PROCEDURE sp_DBR_update_parentCampaign( inParentCampaign bigint(20), inCmpId bigint(20))
    BEGIN

    if(inParentCampaign is not null && inParentCampaign != "") then
    update database.mobc_campaigns set parentCampaignId = inParentCampaign, isDuplicate=1 where campaignId = inCmpId;
    else
    update database.mobc_campaigns set parentCampaignId = null, isDuplicate=0 where campaignId = inCmpId;
    end if;

    END
    $$

    There are two problems here:
    1. My main report(sp_DBR_campaignDuplicateSettings) shows campaign data and when I submit some value for parentCampaign, it is not getting updated in the db. Once I refresh the page, the changes are not getting reflected. I've checked that the report of the procedure "sp_DBR_update_parentCampaign" is working properly.

    2. If I do not attach a separate report to the procedure "sp_DBR_update_parentCampaign", my main report for procedure "sp_DBR_campaignDuplicateSettings" is not working.

    PS: Also any pointers to the logs, if any, generated by MyDBR would be really helpful.

  2. myDBR Team, Key Master

    Hi,
    Check documentation and examples of dbr.editable. You are passing along both the ID and the value. The edited value is automatically added to the call so you do not need to set 'inCmpId=CampaignID'.

    --
    myDBR Team

  3. Nithin, Member

    Hi Key Master,

    I've made the change accordingly. But still now luck. Below is my edited line

    select 'dbr.editable', 'ParentCampaignID', 'sp_DBR_update_parentCampaign', 'inParentCampaign=ParentCampaignID', "select=select campaignId as ID, campaignId from database.mobc_campaigns";

    Please advise.

  4. Nithin, Member

    The below example from documentation actually sends the edited key as well (inWeek=week).

    CREATE PROCEDURE `sp_DBR_InPlaceEditing
    BEGIN

    select 'dbr.editable', 'Budget', 'sp_DBR_update_crosstable', 'inCategory=cat', 'inWeek=week';

    select 'dbr.crosstab', 'Week';
    select 'dbr.count', 'cat';
    select 'dbr.sum', 'Total';
    select 'dbr.hsum', 'Total';
    select 'dbr.hidecolumns', 1;

    select category as 'Film category[cat]',
    payment_week 'Week',
    amount as 'Total',
    budget as 'Budget',
    category_id
    from film_budget;

    END

    CREATE PROCEDURE sp_DBR_update_crosstable(
    inCategory int,
    inWeek int,
    inValue float
    )
    BEGIN

    /* Check the data */
    if (inValue>0) then
    /* Accept the update, no need to return a value */
    update film_budget
    set budget = inValue
    where category_id=inCategory and payment_week=inWeek;
    else
    /* Reject the update, return the original value */
    select budget
    from film_budget
    where category_id=inCategory and payment_week=inWeek;
    end if;

    END

  5. myDBR Team, Key Master

    The below example from documentation actually sends the edited key as well (inWeek=week).

    Nithin,
    In the example the edited column is the 'Budget' column (=budget value). The example passes the ID's for the budget (inCategory & inWeek) and myDBR automatically passes the edited value (inValue). You can see that dbr.editable has no reference to sp_DBR_update_crosstable's third parameter inValue.

    In your case the value automatically passed will be the edited value (ParentCampaignID). So you should pass the CampaignID in dbr.editable and have two parameters in sp_DBR_update_parentCampaign (CampaignID and ParentCampaignID) in that order.

    --
    myDBR Team

  6. Nithin, Member

    Hi Key Master,

    Thanks a lot for the detailed and patient reply. It helped me a lot.

    -Nithin


Reply

You must log in to post.