Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > SQL usage in BizForm drop-down lists View modes: 
User avatar
Member
Member
trouble_shoot - 4/23/2009 9:56:21 AM
   
SQL usage in BizForm drop-down lists
Hi,

I'm trying to create a form from the BizForm tools that makes use of a dropdown-list for populating one of the fields in the form. I plan to use this as a webpart once done.

The form (called Experts Feedback Form) has four fields namely:
(a) From
(b) To
(c) Subject
(d) Message

The 'To' field is the one that is a dropdown-list field type, set to SQL Query.
It contains the ff:

"SELECT EmailAddress FROM KenticoCMS_Expert"

I created a custom table called 'KenticoCMS_Expert' with two fields: 'Expertname' and 'EmailAddress' for use with the To field. I'm trying to figure out what's wrong with the above-mentioned query, because I get the following message:

"Cannot find column 1."

If I run this query in an independent SQL Query Analyzer however, it works out fine.

For some troubleshooting attempt, I tried replacing the query with

"SELECT * FROM KenticoCMS_Expert"

and what I get instead is the underlying "ItemID" field (present during the creation of the custom table).

Has anyone done/encountered something like this before? Or.. am I missing a macro tag somewhere in the query, etc? All and any input is much appreciated.

User avatar
Member
Member
ctaleck IPAGlobal - 4/23/2009 2:34:21 PM
   
RE:SQL usage in BizForm drop-down lists
I seem to remember that I needed to prefix the field with the table name when I worked with custom tables.

Try:

SELECT KenticoCMS_Expert.EmailAddress FROM KenticoCMS_Expert

User avatar
Member
Member
trouble_shoot - 4/23/2009 7:03:38 PM
   
RE:SQL usage in BizForm drop-down lists
Hi,

I tried that also (appending the table name prefix to the field), but the same error message appears.

User avatar
Member
Member
melanie.skeet-macro4 - 4/27/2009 8:07:48 AM
   
RE:SQL usage in BizForm drop-down lists
HI,

I'm no expert but I'm pretty sure that you need to select two columns in your sql query. One for the dropdown list value and one for the dropdown list displayed text. So:

SELECT ItemID, EmailAddress FROM KenticoCMS_Expert

Should do the trick.

User avatar
Member
Member
trouble_shoot - 4/28/2009 6:03:00 AM
   
RE:SQL usage in BizForm drop-down lists

Hi!

Yes, that fixed the problem. That explained why there was an Item ID appearing when I tried running the query with *.

Thank you very much for the help! ^^