Linked Reports

(4 posts) (3 voices)

Tags:

No tags yet.

  1. TICCTech, Member

    I am trying to create some Linked reports and this should be SO easy. I decided to start simple so this is what I have.
    Below is the code for the report that creates a list of students
    When I run it, I get an error that says "Unknown column reference: student_id"
    It does run and I get the list of student names and IDs along with the links at the right of each.
    When I click on the links, it lists the 2nd report and I can click on it. At that point, I get a box prompting for the student ID (presumably because it has not been passed due the first error).
    Could this be related to the data type VARCHAR?

    (The code for the 2nd report "sp_DBR_studentinfolinknew" is further down in this post.)

    $$
    CREATE PROCEDURE sp_DBR_Student_IDs()
    BEGIN
    select 'dbr.report', 'sp_DBR_studentinfolinknew','instudentid=student_id';
    select student_fname AS 'First',
    student_lname AS 'Last',
    student_id AS 'ID'
    from database.students;
    END
    $$

    =======================
    Code for 2nd report

    $$
    CREATE PROCEDURE sp_DBR_studentinfolinknew(instudentid varchar(8))
    BEGIN

    select student_id as 'Student ID',
    allergy as 'Allergy'
    from database.allergies
    WHERE student_id=instudentid;

    END
    $$

  2. jcstevens, Member

    Hey TICCTech,

    I'm not 100% on this but since you aliased student_id as 'ID', I believe you need to change the call line in your first report to:
    select 'dbr.report', 'sp_DBR_studentinfolinknew',instudentid='ID';

    Johnny

  3. myDBR Team, Key Master

    Johnny is right. The column reference should refer to columns in use, which in your case is 'ID'.

    See documentation for column references.

    --
    myDBR Team

  4. TICCTech, Member

    Thanks so much, that did it.
    I can see it now. In my other reports, I use the "as" to denote the column heading. I did not realize that this was also creating the alias. I am using MYSQL here different than I use MS SQL at work so it may either be HOW I am using it or just a difference between the two.


Reply

You must log in to post.