cancel
Showing results for 
Search instead for 
Did you mean: 

splitting a string

Former Member
0 Kudos

Dear all,

             I have to split a string on four parts, how can i use it. 401040302\PCA\CA-PR-E008-14\1234   i want to split this into four parts based on delimiter.

1. 401040302

2.PCA

3. CA-PR-E008-14

4.1234  

please let me know the formula..

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Akram,

The formula to show the first part of the string would be:

Split({Database_field}, "\")[1]

To show the second part, it would be:

Split({Database_field}, "\")[2]


-Abhilash

Former Member
0 Kudos

Dear Abhilash,

                       Thanks for your immediate reply.  I tried Split({Database_field}, "\")[1] which gave me full ouput the same value.  and i tried Split({Database_field}, "\")[2] which gave me an error saying

"A subscript must be between 1 and size of the array"

abhilash_kumar
Active Contributor
0 Kudos

Both the issues indicate that the string is inconsistent!

First issue indicates that it couldn't find the "\" delimiter in the string.

The second issue indicates that the index you specified after the 'split' function is too much. e.g:

String = SAP\Crystal\Reports

and your formula = split({string}, "\")[4]

The string can only be split into three parts however the index specified above is 4 - hence the error.

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

                     I got the result. Thanks for the help. I just need one more help in the same regard.

In my array some times we will not have 401040302\PCA\\1234 the third value.  Then the report throws error. Can i assign value like

1- glaccount

2-division

3- project

4- employee

Regards,

akram

Answers (0)