Highlighted

SQL fed drop down, two label values

Avatar

Avatar

cyan_studios

Avatar

cyan_studios

cyan_studios

16-12-2008

Hello all.

I have a drop down menu that's fed by an SQL database for a timecard. This database has three records for an employee, the first name, last name, and employee ID.



I need the drop down to give me both "fname", "lname", and the actual value needs to be "empl". first name, last name, and employee ID, respectively.



Is there some syntax that can be entered into the binding dialog that will call both "fname" and "lname" to show a full name. These employees are not going to be keen on selecting a first name, then a last name. Plus, if two people have the same last name, we could have conflicting employee ID's from first to last names.



It's a mess.



Any help's appreciated, thank you.

Replies

Highlighted

Avatar

Avatar

pguerett

Total Posts

(val/1000)?string[".0"]}K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

(val/1000)?string[".0"]}K

Likes

611

Correct Answer

692
pguerett

16-12-2008

The dropdown ony supports a single column ...it is not a multiple column display.
Highlighted

Avatar

16-12-2008

Hi,

You could append values from different data columns with the following loop, for example.



while(j<20000)

{



ssText = oTextNode.value;

ssValue = oValueNode.value;

ssText += " / " + ssValue;

this.addItem(ssText);

oDB.next();

j++;

}

your drop down would then be able to show last and first name or more.



Steve
Highlighted

Avatar

Avatar

cyan_studios

Avatar

cyan_studios

cyan_studios

17-12-2008

Steve, I'm very interested in using that technique. So for some clarification, where would I put this script? On a calculate or initialize event in the drop down?



And I assume there are values in your script that I have to replace. Like oTextNode to the text field name in the database, etc.?



In that case, there's a binding that I need to set on this drop down too then, before the script, yes?
Highlighted

Avatar

17-12-2008

Hi,



You could put it in the Initialize event for the drop down.

Look at the script for the custom drop down list in the initialize event. Find the following while statement,



while(!oDB.isEOF())

{

this.addItem(oTextNode.value, oValueNode.value);

oDB.next();

}



Instead of adding just the oTextNode value to the drop down list you can use this string append to display more info from different columns

of your database.



ssText += " / " + ssValue;

this.addItem(ssText);



For example, the "/" could be replaced with a "," and ssText could be

the Last Name and ssValue could be the First Name.



You would then be displaying "Last Name, First Name" in your drop down list.



Steve