144
Views
6
Comments
implementing logic to autoincrement a text field

This is my employee ui. As you can see I had disabled the RecordId option as I don't want that field to be modified by the user. Record Id here is a text value and I want to autoincrement it is there any way to do so. 

I want to know if there is a way or logic to autoincrement text value because that would solve my entire problem.

All my records are overriding on same record id.

Pls help its very urgent.


2023-06-07 04-47-12
Ayush Tyagi

Hello @Chetna Upadhyay ,

Text value means you want what type of Id can you give one example? do you want alphabets also?

UserImage.jpg
Chetna Upadhyay

We want it in integer form only. as this record id is being used for fetching data.


2023-06-07 04-47-12
Ayush Tyagi

Simply go for Entity identifier's attribute property for data type as integer/long integer and choose auto number as yes.

and If you still want a logic you can try the below one : 

TextToIdentifier(IntegerToText(TextToInteger(GetStudents.List.Current.Student.Id)+1))


2025-12-12 06-45-53
Nandhakumar Sureshbabu

In that case, you can use assign operator and add the respective integer + 1 or if it was an id then set it to auto number property to true in that respective entity.

Hope it helps.


Regards,
Nandhakumar S.

2022-07-11 07-49-33
Alka Asnani

Hi 

If you want it to be in integer set its data type to integer and set the is auto number property to Yes as it auto-increment numeric identifier for database records.

or else

using assign operator assign the following values-

=current record id

= current record id + 1


Hope this helps 

Thanks

2023-03-16 16-29-51
Paulo Rosário

Hello Chetna, 

I see that you already have a bunch of replies but I would like to suggest something different.

As I understand it you want the record ID to be editable and you are having trouble because when saving your other records are being overridden. 

Having editable Identifiers is not considered a good practice and as many have pointed out, for entities, the id should be placed as an Auto increment to avoid the issues you are dealing with now, but I don't know your specific use case.

that being said, one way to guarantee that this does not happen is to check the last saved record in your entity and add 1 to that id.

you can do this by using an aggregate that returns the last record on your table ( max records = 1, sort by id descending, and using that id value to increment.

This can be implemented directly before you save a record.

Hope this helps!

Paulo Rosário 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.