This topic is locked

combining fields

2/22/2006 1:02:25 PM
PHPRunner General questions
R
renegadekn author

I have two fields that I need to combine into one. One of the fields is a 5 digit alphanumeric Identifier that is unique base on the user that is logged in, the other is an autonumber. I need to be able to create a field that is the two combined. Can this be done in phprunner and if so how? If there is a way to combine and display the two fields in a read only manner, that would be the favored method if it is possible.
Thanks,
-Rob

Sergey Kornilov admin 2/23/2006

Rob,
you can modify SQL query to concatenate two fields into one. Use concat function in MySQL for this purpose.

select ...,

concat(firstname, ' ', lastname) as fullname

from ...
D
DouglasB 2/27/2006

This could work if I wanted to create a field for a unique employee code (other than the primary key) to print on employee ID cards couldn't it? I would place this code in the Events portion of the phpRunner right?

Rob,

you can modify SQL query to concatenate two fields into one. Use concat function in MySQL for this purpose.

select ...,

concat(firstname, ' ', lastname) as fullname

from ...
Sergey Kornilov admin 2/28/2006

Douglas,
yes, you can use BeforeAdd event.

Just put this code there:
$values["EmployeeCode"]="'".$code."'";
where EmployeeCodeis your field name and $code contains unique employee code.