cancel
Showing results for 
Search instead for 
Did you mean: 

variable help. delete string after 3rd comma

former_member557046
Participant
0 Kudos

Hi Guys,

I have a column as such in a report:

45 L, xyz, abx, alalalalalalla

740 L, abcd, hyr, alspdifkala;

2050 L, adl, pzs, prajdlap

I need to remove all data after that 3rd comma.

45 L, xyz, abx

740 L, abcd, hyr

2050 L, adl, pzs

Can anyone help?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

amitrathi239
Active Contributor
0 Kudos

Use this.

in the formula Value is the object which have all values.

=Substr([Value];1;Pos([Value];",")+1)+Substr([Value];(Pos([Value];",")+1);Pos(Substr([Value];(Pos([Value];",")+1);Length([Value]));",")+1)+Substr([Value];Length(Substr([Value];1;Pos([Value];",")+1)+Substr([Value];(Pos([Value];",")+1);Pos(Substr([Value];(Pos([Value];",")+1);Length([Value]));",")+1));Pos([Value];",")-2)

former_member557046
Participant
0 Kudos

Hi ,

Thank you amit.

I have one more question.

Some records have as follows

2,063 L, xxy, acv, ahhhh

In this case I want that first comma ignored.

2,063 L, xxy, acv

Can I do this?

Thanks

amitrathi239
Active Contributor
0 Kudos

is this full string coming from the one object or you are doing concatenation to combine the objects?

former_member557046
Participant
0 Kudos

Hi,

The object had data like that.

I fixed it by altering your code to ", " since the important comma's in question had a space after the comma.

Displays fine now.

Thank you

Answers (1)

Answers (1)

former_member198519
Active Contributor
0 Kudos

This will give you the required output

[Pos1]=Pos([Text];";")

[Pos2]=Pos(Substr([Text];[Pos1]+1;Length([Text]));";")

[Pos3]=Pos(Substr([Text];([Pos1]+[Pos2])+1;Length([Text]));";")

[Final]=Substr([Text];1;([Pos1]+[Pos2]+[Pos3])-1)