Creating Popups

(2 posts) (2 voices)

Tags:

No tags yet.

  1. TICCTech, Member

    Please excuse me if this seems like a very simple question but I am new to myBDR and don't have a lot of SQL experience though I am familiar with basic queries.
    I keep getting the error "DB error (1054): Unknown column 'student_id' in 'field list'" when trying to create a report with a popup.
    I am trying to follow the examples as a guideline but I just can't seem to get it right. I really feel like I am missing something simple but I have spent hours staring at it.

    My Popup Parameter query looks like this
    select 0, 'All'
    union
    select student_id, StudentsID

    I have tried multiple variations.
    If I use this - select student_id, StudentsID
    I actually get style popup but my only two options to select are "All" and "StudentsID". I don't get the list of IDs to choose from like I want.

    My report query looks like this:
    DROP PROCEDURE IF EXISTS sp_DBR_StudentInfo
    $$
    CREATE PROCEDURE sp_DBR_StudentInfo(stuid tinyint)
    BEGIN

    select s.student_fname as 'First Name',
    s.student_lname as 'Last Name',
    s.student_id as 'ID',
    s.student_home_phone as 'Home Phone',
    s.student_mailaddress1 as 'Mailing Address',
    s.student_mailaddress2 as ' ',
    s.student_city as 'City',
    s.student_state as 'State',
    s.student_zip as 'Zip',
    s.student_911address1 as '911 Address',
    s.student_911address2 as ' ',
    s.student_911address_city as 'City',
    s.student_911address_state as 'State',
    s.student_911address_zip as 'Zip',
    s.county as 'County',
    s.school_district as 'School District'
    from dbname.students s
    WHERE s.student_id
    IN (
    SELECT student_id
    FROM dbname.students
    WHERE student_id = stuid OR stuid = 0);
    END
    $$

  2. myDBR Team, Key Master

    You seem to be missing the table from which the student_id, StudentsID are fetched from:

    select 0, 'All'
    union
    select student_id, StudentsID

    The query parameter should look something like this:

    select 0, 'All'
    union
    select student_id, StudentsID
    from dbname.students_table

    Please also check the report parameter which you have defined as tinyint. Tinyint can hold numbers from 0 to 255, so you might want to check if this really matches the datatype of dbname.students.student_id.

    --
    myDBR Team


Reply

You must log in to post.