cancel
Showing results for 
Search instead for 
Did you mean: 

Create a WebI variable on the base of string that has dynamic values

former_member793810
Active Contributor
0 Kudos

I need to crate a variable on the base of a string which has dynamic values.

This string has various values that I want to indicate with some identifier.

Suppose I have value "afdfa2324 MMA 7897acncn" that I want to identify as "MMA" and I have a value "A2M3" that I want to show as "Mark". The pattern remains (AlphaNumericAlphaNumeric) the same but value changes. I can get the value for the first one using If statement but since the Values are changing for the second one I don't know what formula to use.

appreciate your help. Thanks

nscheaffer
Active Contributor
0 Kudos

How do you know what to substitute for Value 2 ("A2M3") if it is dynamic? Are you saying that anything with a pattern of AlphaNumericAlphaNumeric should be changed to "Mark"? Please clarify.

Noel

Accepted Solutions (0)

Answers (2)

Answers (2)

mhmohammed
Active Contributor
0 Kudos

Hi Bashir,

Does the workaround help?

Thanks,
Mahboob Mohammed

mhmohammed
Active Contributor
0 Kudos

Hi Bashir,

I quickly created some sample data, and also the variables required to address your requirement. (A = Alpha, N=Numeric)

1st Char AN Flag =If(IsError(ToNumber(Substr([String];1;1)))) Then "A" Else "N"
2nd Char AN Flag =If(IsError(ToNumber(Substr([String];2;1)))) Then "A" Else "N"
3rd Char AN Flag =If(IsError(ToNumber(Substr([String];3;1)))) Then "A" Else "N"
4th Char AN Flag =If(IsError(ToNumber(Substr([String];4;1)))) Then "A" Else "N"

Finally, a Group variable with below formula

=If(Match([String];"*MMA*")) Then "MMA"
ElseIf([1st Char AN Flag]="A" And [2nd Char AN Flag]="N" And [3rd Char AN Flag]="A" And [4th Char AN Flag]="N") Then "Mark" Else "Others"

Voila, here is how the result looks like, seems its working. Hope that helps!

Thanks,
Mahboob Mohammed