These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Drop down menu, item text having two column values?

cyanstudios
Registered: May 6 2008
Posts: 81

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.

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
If you listed the employee's name as "Last, First" you could then use FormCalc or JavaScript to split the "Last, First" string at the ",".

In FormCalc:

var fSep = At(empl, ",") // get location of ","
lname = Substr(empl, 1, fSep - 1) // data before ","
fname = Substr(empl, fSep + 1, Len(empl) - fSep) // data after ","

George Kaiser

cyanstudios
Registered: May 6 2008
Posts: 81
Well, the first name is a field in the database.
The last name is another field in the database.
Last, the Id number is another field. All are associated by record.

So I'm not sure what you mean by string. Do you mean a hidden field that grabs these values, concatenates them into strings, and then parses them out to be contents of the drop down?
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
If you are trying to get the employee's name from the database, why not have them enter teir employee ID and retrieve the name fields from the database by the employee ID?

A string is a series of characters, numbers, and white space and not restricted to numbers, decimal, and sign.

George Kaiser

cyanstudios
Registered: May 6 2008
Posts: 81
You know, even though we're talking the overhaul of a company policy, I think you may be onto something. An employee ID number is a lot easier to do.

As for the string, I do understand what a string is. I guess my confusion is on the fact that the entire name isn't a string until it's been concatenated. Currently, I can only get one drop down to reference one field of the database at a time, whereas the first and last names are in separate fields.
cyanstudios
Registered: May 6 2008
Posts: 81
Ok so let's say someone chooses an employee ID from the drop down. Should the text AND the value of the drop downs be the same, employee ID?

If so, let's say I have a text field underneath and I want it to show the name of whom they picked, how would I get it to grab the corresponding values to the emp ID picked?

suppose the drop down is named employee and the text field is on the same level of the heirarchy.
cyanstudios
Registered: May 6 2008
Posts: 81
I got this by grabbing a data drop down from the library, then editing the initialize code to have one new variable for "lname", then just appended that to the display value of the drop down.