Reputation: 259
I'm working on a project around dynamics AX 2012, and I want to add some fields in CustTable.
I want to add a unique field that has 11 characters and consists of 4 digits
1: 1 character for sex
2: 2 character for year of birth
3: 2 character for month of birth
4: 6 character this character should be auto-increment
How can i complete this , and when i create the new form how can I implement this field automatically?
Thank you
----------------------------post update------------------------------------------
Thank you for reply,
The field that I want create is composed of 10 character's divided into 4 components(segment/digit)
What i want is: how to create the unique field (cust_Id for example) that consists of 4 segment.For example if i want create new customer , in form ,I seized sex & date birth and other .
I want to create this field :
1. Gender (1 digit)
•1 for men
•2 for women
2. Year of birth (2 digits)
• The last two digits of the year
• Example: 78 for 1978
3. Month of birth (2 digits)
4. Order number (5 digits) auto increment
Global example:
men 22/03/1990 00001
When I submit the form the field must contain this value : 1-90-03-00001 that is the unique identifier of new customer inserted generated automatically.
next record :
women 30/12/1994 00002 => value : 0-94-12-00002
I did some research, I found that I can do that by Number Sequence scope or segment, thank you
Upvotes: 0
Views: 1616
Reputation: 118
You can accomplish by creating a number sequence, but that would be a little hectic solution, since your requirement is unique, you should go for a unique and simpler solution,
if i were you,i would add a text field in the CustTable, and add multiple drop down controls on my form(for gender, DOB etc) each bound by an enum , and when the form submits take those returned values and format them according to ur requirement ( 1-90-03-00001)
for the last auto increment number, you can fetch the last inserted record, then split it with "-" and increment the last number by one.
Upvotes: 0
Reputation: 5117
To add a field to a table, have a look at How to: Create Tables [AX 2012], "Add Fields to a Table".
To add a field to a form, have a look at How to: Add Fields to a Details Form [AX 2012].
That being said, I strongly suggest to not create a field that contains several bits of information. Instead you could take a look at the DirPerson table that contains fields for gender, month of birth and year of birth and try to figure out how to make them available on the customer.
Upvotes: 2