Send linked report mysql variable?

(2 posts) (2 voices)
  1. eellis, Member

    I do apologize if this has already been addressed, but I'm kind of baffled as to why I'm having the problem I am.

    Due to some schema issues, I'm having to tease out and glue data together for reports. In one particular report, I'm setting the following:


    select @attempt_ids := group_concat(id separator ',') from reporting_v3.attempts where user_id in (@user_ids);

    This works, bringing back a comma separated list of values when I use it in mysql.

    It works as expected when using that value within a report:


    select 'dbr.title', @questionnaire_attempt_ids;

    What I can't figure out is how to pass that to a linked report. Is there a way to do this, or will I have to have some duplication in my queries to get the linked reports to work?

  2. myDBR Team, Key Master

    You can add the variables as columns in select -statement and refer to them as any other column.

    Btw, you should not use session variables (@var) unless you absolutely need (dymanic SQL). Use normal local variables instead (declare v_var int). Local variable has a defined datatype and you do not need to worry that another called routine changes the variable.

    --
    myDBR Team


Reply

You must log in to post.