editable report - doesn't update record. Does work when update report is run from mydbr report

(5 posts) (2 voices)

Tags:

No tags yet.

  1. john, Member

    My first attempt at editing a report, seems simple enough but record is not updated.

    It does work when I run the update report and supply the values at the parameter selection screen.
    It does not work when editing report.
    In Editable Report:
    -Dropdown works
    -Value selected shows in cell
    -When I refresh the report the data reverts to original value.

    Note: i only require one value in the select for the drop down, but even changing it to 2 so i include an id column doesn't help.

    Report code for update procedure


    DROP PROCEDURE IF EXISTS sp_DBR_update_customername
    $$
    CREATE PROCEDURE sp_DBR_update_customername(
    incustomername varchar(255),
    inID int
    )
    BEGIN /* Check the data */
    #if (inValue>0) then
    /* Accept the update, no need to return a value */
    update test.projects1
    set CustomerName = incustomername
    where ID=inID;
    #else
    /* Reject the update, return the original value */
    # select budget
    # from film_budget
    # where category_id=inCategory and payment_week=inWeek;
    #end if; END
    $$ END

    Editable Report Code


    DROP PROCEDURE IF EXISTS sp_DBR17
    $$
    CREATE PROCEDURE sp_DBR17(project_name_in varchar (15))
    BEGIN
    -- Hide ID
    select 'dbr.hidecolumn', 'ID';
    -- Show category as a selectlist
    select 'dbr.editable', '[CustomerName]', 'sp_DBR_update_customername', 'inID=ID', 'incustomername=CustomerName', 'type=select', "select=select distinct
    test.projects1.CustomerName AS CustomerName2
    from
    test.projects1
    order by test.projects1.CustomerName";
    select 'dbr.colstyle', 'ID', mydbr_style('noformating');
    select 'dbr.colstyle', 'NetworkNumber', mydbr_style('noformating'); select
    p.ID as 'ID',
    p.ProjectNumber as 'ProjectNumber',
    p.CustomerName as 'CustomerName',
    p.NetworkNumber as 'NetworkNumber'
    from test.projects1 p
    WHERE
    p.ProjectNumber = project_name_in; -- Hide ID
    select 'dbr.hidecolumn', 'ID';
    -- Show category as a selectlist select
    p.ID as 'ID',
    date(p.Customer Quote Due Date )as 'Customer Quote Due',
    date(p.Customer Start Date) as 'Customer Start',
    date(p.Customer Completion Date )as 'Customer Completion',
    date(p.Awarded Date )as 'Awarded',
    date(p.Prefield Done Date )as 'Prefield Done',
    date(p.Take off Completed Date) as 'Take Off Completed',
    date(p.BOM Completed Date )as 'BOM Completed',
    date(p.Construction Completed Date )as 'Construction Completed',
    date(p.Asbuilts submitted date) as 'Asbuilts Submitted',
    date(p.Project Complete Date) as 'Project Complete'
    from test.projects1 p
    WHERE
    p.ProjectNumber = project_name_in; END
    $$

  2. john, Member

    I threw another table in the db to capture the variables being passed from the editable report to the update procedure.
    The values passed are:

    id = 0
    customername = original value

    How do i pass the new values to the update procedure, can't seem to reference them correctly.

    Thanks

  3. john, Member

    Figured it out
    mydbr passes the value to update automatically
    Once i took out the second parameter in the select 'dbr.editable' the correct id was passed.

    I missed this as when looking at this page
    Editable report

    There wasn't an example for 'sp_DBR_film_editing_category' so i guessed and also guessed to pass another parameter. When i looked at the 'sp_DBR_film_editing_description' i found my errors.

  4. myDBR Team, Key Master

    The source code of sp_DBR_film_editing_category has been added to the example.

    --
    myDBR Team

  5. john, Member

    Congrats on resolving quickly. Only posing as i noticed it is in wrong code block. It is in Source code for "Editable report". The example documentation is well presented I wouldn't want to be responsible for an error.
    Have a nice day.


Reply

You must log in to post.