default parameter query using a non-INT as the key

(2 posts) (2 voices)

Tags:

No tags yet.

  1. adamhaeder, Member

    I have a number of checkbox fields that have varchars as the 'key' instead of INTs. For example, I have a field called client status. The values for client status are stored in the database as:
    shortname: active, name: Active shortname: suspend, name: Suspend shortname: renego, name: Renegotiate shortname: pending, name: Pending shortname: prepend, name: Pre-Pend

    I'm presenting this selection to my end user as a checkbox, and I want them all checked by default. So my 'default' query assigned to this checkbox is:
    SELECT GROUP_CONCAT(shortname) FROM datawarehouse.careerlink_status;

    However, this doesn't seem to work, as none of the boxes are checked by default. I have other checkbox entries where this does work, and it seems that the ones that work have an INT field of id that I'm using in my GROUP_CONCAT function, and the ones that don't work I'm using a varchar field there. Any way to make these checked by default?

  2. myDBR Team, Key Master

    That was close. Just add apostrophes around the individual strings:

    SELECT GROUP_CONCAT(CONCAT("'",shortname,"'"))
    FROM datawarehouse.careerlink_status;

    --
    myDBR Team


Reply

You must log in to post.