How to increment a string/text in outsystems?

Hi everyone,

I have string / data type text

Example: 

var_text : "A"

How can I increment the variable to produce something like this? I would to use it in a service action. Before updating a records, I need to increment an attribute with data type text.

Idea

var_text++

Results: 

A
B
C
...
X
Y
Z
AA
AB
AC
...
AZ
mvp_badge
MVP
Solution

Hi Ezra,


You can use the ASCII utilities forge component to do this on server side (since you mention you want to use it in a service action.


Kind regards,

João

Hi João,

Is there other ways than using forge component?

Thanks.

mvp_badge
MVP

Well, you can implement it yourself but I'm not a big fan of reinventing the wheel, so I would use what is already done if it works nicely like this one.

Champion

Hi,


Basically you convert the String (should be char) to int.

https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_parseint


Thanks

mvp_badge
MVP
Solution

Hi Ezra,


You can use the ASCII utilities forge component to do this on server side (since you mention you want to use it in a service action.


Kind regards,

João

Hi João,

Is there other ways than using forge component?

Thanks.

mvp_badge
MVP

Well, you can implement it yourself but I'm not a big fan of reinventing the wheel, so I would use what is already done if it works nicely like this one.

I didn't see any existing forge component available for this. However, you can create your own plugin where you can write some .NET code (use operator overloading feature as increment/decrement operator, increment of ASCII code, etc.).

Thank you for sharing your solutions.

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