Fetch the last 3 characters of a property value and pass as a parameter

Hi All,

I have a requirement to fetch last 3 characters of a property value and check if it matches in the current iteration of a Pagelist.

Ex: I have Param.LastThreeChar=“ABC”

Param.ABCIndex=@IndexInPageList(“Param.LastThreeChar”,“.AppNumber”,.Countries)

But I want to pass the last three characters of .AppNumber property value into “Param.LastThreeChar” and then fetch its index.

How can pass a regular expression into Param.LasThreeChar? I tried holding Para,.LastThreeChar=“^..*ABC$” but it is not working..

Is there any way to pass last 3 characters of a property value?

Thanks,

Sakhib Hussain

@SakhibHussain

You can try using substring function. Please find the syntax below.

Substring ( String, Length of the string - 3 )

@HariPriyaY

I tried using the above. But it is not working. Attached the screen shot.

@SakhibHussain

Length of the string can be found using length function. please try using the below syntax.

@HariPriyaY

Yes tried, but since I have used @IndexInPageList() and .countries as a Pagelist and .AppNumber is a property inside .countries Pagelist, it throws me an error.

@SakhibHussain

Please provide the below details

1.what is the property for which you want u to fetch last 3 characters.

2.Can that property value have special characters as well in the end. If yes,do you want to fetch only non special characters?

3.And does the AppNumber property in countries pagelist have only 3 characters because indexinpagelist always does the exact match and returns the index

@HariPriyaY

  1. .AppNumber Ex: AppNumber=“BDE123-ABC” So I want to fetch last 3 characters of this which is “ABC”

  2. No. This property value does not have any special characters. Just want to fetch last 3 characters every time.

  3. No. AppNumber has many characters in addition to 3 character which I am trying to fetch. Ex: AppNumber=“BDE123-ABC” or AppNumber=“ERT123-ACC” So here last 3 characters I am trying to fetch i.e. ABC or ACC

I got the solution for the above

  1. Create a When rule “CheckABCTextAtLast”

  2. Use the following expression @pxContainsViaRegex(.ApplicationNumber,“^.*(?i)ABC$”,true)

This is a regular expression function which will ignore the case of ABC as well and return true if last letters are ABC/ABc/aBC etc.

  1. To get the index of the page list which satisfies above use

@IndexInPageListWhen(“CheckABCTextAtLast”,.Countries)

Thanks,

Sakhib Hussain

@HariPriyaY

I have changed a logic a bit. I have included substring function below, .Countries loop. So this will going to fetch the last 3 letters in the .AppNumber which is inside the current .Countries loop itself.

Thanks a lot @HariPriyaY for your responses. I appreciate that.

Thank you.