This topic is locked
[SOLVED]

 Concatenate two fields into another on add / edit / import

10/18/2015 6:16:12 AM
PHPRunner General questions
S
sporrencense author

Hi,
I have a new project and within this I have a table called "lfab_dat_main". The fields in this table are:
Combined Standard Archive Code,

Standard Archive Code,

Fabric Name,

Fabric Tradition Group,

Alpha Numeric Code 1,

Alpha Numeric Code 1 Title,

Alpha Numeric Code 2,

Alpha Numeric Code 2 Title,

Other Published Names Display,

Other Published Names Search,

Production Evidence,

Ref Sherd Location,

Updated,

Updated By,

Created,

Created By,

Owner,
Owner field is completed as a read only field with default and autoupdate value of $_SESSION["OwnerID"] thus putting the id number of the logged in user into the record.
I am looking to concatenate the fields "owner" and "standard_archive_code" and insert them into combined standard archive code which will be the primary key. I am looking for format "owner-standard_archive_code" which would output as e.g. "2-bhs". I think I either need to do this in the default values for readonly input of the combined standard archive code field or to do it as an event on before recorded added / updated but I am unclear how to approach this. Could you point me in the right direction please?
I have looked through the help and forum but couldn't find anything similar.
Thanks
Ben

S
sporrencense author 10/18/2015

OK, don't worry I solved it by adding:
$values["combined_standard_archive_code"]=$values["owner"]."-".$values["standard_archive_code"];
to the before record added event.



Hi,
I have a new project and within this I have a table called "lfab_dat_main". The fields in this table are:
Combined Standard Archive Code,

Standard Archive Code,

Fabric Name,

Fabric Tradition Group,

Alpha Numeric Code 1,

Alpha Numeric Code 1 Title,

Alpha Numeric Code 2,

Alpha Numeric Code 2 Title,

Other Published Names Display,

Other Published Names Search,

Production Evidence,

Ref Sherd Location,

Updated,

Updated By,

Created,

Created By,

Owner,
Owner field is completed as a read only field with default and autoupdate value of $_SESSION["OwnerID"] thus putting the id number of the logged in user into the record.
I am looking to concatenate the fields "owner" and "standard_archive_code" and insert them into combined standard archive code which will be the primary key. I am looking for format "owner-standard_archive_code" which would output as e.g. "2-bhs". I think I either need to do this in the default values for readonly input of the combined standard archive code field or to do it as an event on before recorded added / updated but I am unclear how to approach this. Could you point me in the right direction please?
I have looked through the help and forum but couldn't find anything similar.
Thanks
Ben