Skip to Content
Former Member
Jul 25, 2014 at 11:57 AM

Crystal report - how to split a field into more fields



I`m new to Crystal reports and I`ve got a trouble. I have field which contains an address - street, city, zip code. The example is:

STEHLIKOVA 977 165 00 PRAHA 620 - SUCHDOL 165 00.

What I need to achieve is to split this string into three separated fields. I`ve trouhg a couple of forums but haven`t been able to find a proper answer. The problem is that the addresses differ so I can`t use an absolute defining of a start position. Looking at the DB (HEXA code) the parts in the string are divided by two dots:

STEHLIKOVA 977..165 00 PRAHA 620 - SUCHDOL..165 00

I`ve been able to work out this solution:

stringVar array x := split({cparty.STREET_ADD},"..");

Local numberVar i;

Local stringVar outputString := "";

For i:=1 to Count(x) do


outputString := outputString + x[i] + Chr(10)



It splits the string into three rows:


165 00 PRAHA 620 - SUCHDOL

165 00

And I don`t know how to find the end of each row so to be able to separate the strings and report them as three different fields.

Would be anyone so kind and help me out with this?

Thank you.