parameter parsing custom string

(5 posts) (2 voices)
  1. cnbg-n, Member

    HI,

    how can i parse a custom string into a procedure?

    following does not work. (Unknown column reference: "klz")

    select 'dbr.editable', 'xklz', 'sp_DBR_update_retailers', 'in_retailer_id=[rid]', 'in_column="klz"';

    select
    znr,
    klz as 'klz[xklz]'
    retailer_id as 'id[rid]'
    from pst_germany.retailers
    where exp_date is null
    order by znr;

    to save the value...

    CREATE PROCEDURE sp_DBR_update_retailers(
    IN in_retailer_id INT,
    IN in_column VARCHAR(100),
    IN in_value VARCHAR(100))

    BEGIN

    SET @s = CONCAT('update pst_germany.retailers set ',in_column, '="', in_value, '" where retailer_id = ', in_retailer_id );
    PREPARE stmt FROM @s;
    EXECUTE stmt;

    END

    thanks
    chris

  2. myDBR Team, Key Master

    Prior to myDBR 3.9.3 build 2069 you can add the string as a column in the query and use it as normal column reference. The column in question can be hidden if so wanted.

    In myDBR 3.9.3 build 2069 we introduced a way to pass variables directly from the dbr.reprot/dbr.editable/dbr.url command. The syntax is the same that you used (quotation marks).

    --
    myDBR Team

  3. cnbg-n, Member

    nice to read this. :)

    we will wait on this release.

    thank you
    chris

  4. cnbg-n, Member

    any ideas or workaround to solve this instead building lot of single procedures
    i've tired...

    'type=select',"select=select 'klz' as in_column from dual";
    but it does not work too because the id is needed.
    to concat the "select..." incl. id into a var for each field will be very crazy.

    how can i update all values at one time?

    as example:

    declare vin varchar;
    set vin = concat("select=select retailer_id, znr, klz, firma ,receiving_type, delivery_day, delivery_type, loading_type_preqc, loading_type_dcs3, loadertool from pst_germany.retailers where retailer_id=",cast(rid as CHAR));

    select 'dbr.editable', 'xklz', 'sp_DBR_update_retailers', 'in_retailer_id=[rid]', 'type=select',vin;

    but the procedure sp_DBR_update_retailers will await one inValue only!?

    thx
    chris

  5. myDBR Team, Key Master

    nice to read this. :)

    we will wait on this release.

    No need to wait. Just run the updater and get the latest build.

    'type=select',"select=select 'klz' as in_column from dual";
    but it does not work too because the id is needed.

    Not quite sure what you mean here, but you can select-parameter defines the selectlist shown to user when the editing happend. It can return both the id and the visible value. When both are defined, the visible value is show to user and the id is passed into the editing procedure. You can take a look at the demo.

    how can i update all values at one time?

    The edited value is saved as soon as the editing of the single value is done so concept of editing 'records' do not exists. If you have a lot of fields that can be edited, you just need to put a procedure for each one of them (or create one for each datatype and pass the column name as in your original report did).

    --
    myDBR Team


Reply

You must log in to post.