This topic is locked

Record an Concatenated value

9/8/2010 11:34:48 AM
PHPRunner General questions
D
diggydog author

Please forgive me if this seems a stupid request but I have a field which I want to store a value which is a concatenation of values from 3 other fields in the same record. Here is an example:
Field 1: Type

Field 2: Size

Field 3: Colour

Field 4: concat(Type,' ',Size,' ',Colour) e.g Ipod 30gb Blue
I can get the correct result to display if I use sql query or "view as" custom in the visual editor but I cannot get the value to record in the table so I can use it in conjuction with another table.
Can anyone help guide me in the right direction, as you can see I am far from an expert and would appreciate the help.
Many Thanks.

W
wildwally 9/8/2010

I'm having a similar issue with another field.
I've posted something in here asking just about the same quesiton. When an answer is provided I'll be sure to pass it along. But understand that there is very little traffic through this forum, so getting answers might take day(s).

Sergey Kornilov admin 9/8/2010

To save concatenated value in the database you need to use BeforeAdd/BeforeEdit events.
http://xlinesoft.com/articles/amount_to_single_field.htm (bullet 2)
Another example:

$values["FieldWhereYouWantToSaveIt"] = $values["Type"] . ' ' . $values["Size"] . ' ' . $values["Colour"];