cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

A function in Webi which gives the position of specific caharacter's occurrence multiple times

HiShilpiRanjan
Explorer
0 Kudos
1,703

Hi All,

Can you please help me with a function in Webi which gives us the position of some character's occurrence multiple times in the same string.
Pos() function gives the position of a character, however if the same character is present multiple times, how to get its position.

For example:
String(1): AP 0,G3 16.36,HK 0,B5 5.62,WY 16.53
String(1) is a column which has this concatenated text and numbers as above.

Now, I need to know the position of all commas and spaces present in this string more than once.

Can u please help me with the formula to get the following splitted from String(1):
String(1): AP 0,G3 16.36,HK 0,B5 5.62,WY 16.53

AP---- =Substr([String(1)];1;(Pos([String(1)];" ")-1))
0   ---  need formula here
G3 -- =Substr([BILLED_TAX_STRING];(Pos([BILLED_TAX_STRING];",")+1);(Pos([BILLED_TAX_STRING];" ")-1))
16.36 -- need formula here
HK    -- need formula here
0       -- need formula here
B5     -- need formula here
5.62   -- need formula here
WY     -- need formula here
16.53  -- need formula here

Please don't Hardcode the values, as we have different values in the report for String(1)
More examples for String(1) values present in the same report:

                String(1)
AP 0,G3 16.36,HK 0,I5 5.62,WY 16.53
AU 30.91,WG 5.22,WY 8.9
L7 1.76,OP 0,SG 3.51,WG 1.6,WY 14.63
QR 7.97,QR 2.32,WG 3.35,WG 0
E7 .78,G8 .34,TS 15.55,WG 0,WY 0
F1 2.47,IA 8.04,KK 11.57,WG 0,WY 0


If anyone can help, would be really helpful.
Thank you in Advance🙏


Regards,
Shilpi



View Entire Topic
nachtaktiv
Participant

use the example/link I already gave you in your last question
to solve this with nested variables !

HiShilpiRanjan
Explorer
0 Kudos

Thank-you for this however not able to reach to solution yet, there is still some challenge. Please find the snippet below:

HiShilpiRanjan_0-1710994990668.png

As the length of Tax_String changes, the variable is not giving correct result for all the Tax_String values.
If u see the third row above, I am not getting Tax_Code3_Value. Similarly we have different lengths of values for Tax_String.

Is there any way you can help.

What I was thinking is to apply IF condition on the number of commas in Tax_String for all my headers, however not able to find that how to count the number of commas in the Tax_String.
Is there any way to count the number of specific character in a string in Webi.

Thank-you in advance