How to convert to string from arguments

I have an argument the value is FY25

I want the result to be 25-1 as 24

Please help me ASAP…

Hi @Sneha_1992

Would the format of the data remains FY__ all the time?

If so, you can use a substring function to obtain ‘25’, convert it into an int & subtract 1 from it, so that your desired result will be generated.

Expression for this:

Let’s say resultData is of a datatype Integer

resultData = CInt(inputString.subString(2,2).ToString.Trim)-1

Hope this helps,
Best Regards.

Use regex to extract the numbers

  1. Assign activity
    argumenVariable = "FY25"
    strNum = System.Text.RegularExpression.Regex.Match(argumenVariable, "\d+").ToString

This give you value 25

Assign activity

MyValue = Convert.ToInt32(strNum) - 1

MyValue will be 24

Hi @Sneha_1992

Try this:

value = "FY25"

result = CInt(value.Substring(2)) - 1

result is of DataType System.Int32

Check the below image for better understanding @Sneha_1992

Regards

@Sneha_1992 if you need,

Output with FY —> “FY25”.Substring(0,2)+”(CInt(FY25.Substring(2,2))-1).ToString”

Note: In above query you have to replace “FY25” with Variable name. And Output will be in String FY24

Without FY:

(CInt(FY25.Substring(2,2))-1).ToString

Note: Above query will give you output as Int32.

Regards,
Ajay Mishra

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.