![]() |
mikue from germany 12/3/2012 |
Hi, |
![]() |
Admin 12/3/2012 |
You cannot have two autoincrement fields, most databases do not offer such a feature. If you only looking for a human readable way to display IDs, use calculated field in your SQL query. select |
S
|
snape author 12/4/2012 |
Hi, second reference field in mysql ( INT, not varchar ) before add event $rstmp = CustomQuery("select max(ReferenceNo)+1 as m from tablename"); $datatmp = db_fetch_array($rstmp); $values["ReferenceNo"] = $datatmp["m"]; hint: change ReferenceNo and tablename according to your need in visual editor list view select field ReferenceNo and switch to custom code here you are able to build mixed number/character appearance write in custom code window $value ="i".$value;
|
S
|
snape author 12/4/2012 |
You cannot have two autoincrement fields, most databases do not offer such a feature. If you only looking for a human readable way to display IDs, use calculated field in your SQL query. Assuming that ID is your autoincrement column you can use something like this (MySQL): select
|
![]() |
mikue from germany 12/4/2012 |
Hi Spencer, |
S
|
snape author 12/4/2012 |
Hi Spencer, let us assume your varchar field named ReferenceNo holds values like il1000, il1001, il 1002 ... since your are not able to calculate with varchar fields you have to make numeric value by splitting the leading 2 characters add page - process record values ( so you will have a chance to control the value before saving ) $rs = CustomQuery("select max(mid(ReferenceNo,3,7))+1 as internalNumber from tablename"); $data = db_fetch_array($rs); $values["ReferenceNo"] = "il".$data["internalNumber "]; Best regards Michael
|
![]() |
mikue from germany 12/4/2012 |
Hi Spencer, |
S
|
snape author 12/4/2012 |
Hi Spencer, nothing to add, only use these lines in process record values and forget my reply before. Just try it .. if there are more question about that issue so ask again, no problem. Greetins Michael
|
S
|
snape author 12/5/2012 |
OK great thanks will do. Spencer
|