Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Split String Post Reply Post New Topic
Author Message
clom315
Newbie
Newbie


Joined: 07 May 2012
Location: United States
Online Status: Offline
Posts: 1
Quote clom315 Replybullet Topic: Split String
    Posted: 07 May 2012 at 10:37am
I have a set of strings that are in the following format:

PRODUCT-OPT;Color:Silver=SKU1&Color:Blue=SKU2&Color:Green=SKU3

I would like split out "SKU1", "SKU2", "SKU3" into a list of skus from this string. The items I need are surrounded by "=" and "&" if that helps. I'm pretty new to Crystal Reports and just learning my way around. If anyone can help that would be great. Thank you.
IP IP Logged
LynnB
Newbie
Newbie


Joined: 08 May 2012
Online Status: Offline
Posts: 15
Quote LynnB Replybullet Posted: 09 May 2012 at 1:42pm
Hi,

You could use the split function,
eg.
local stringvar tst := 'PRODUCT-OPT;Color:Silver=SKU1&Color:Blue=SKU2&Color:Green=SKU3';
local numbervar x := 0;

shared stringvar txt1 := '';
shared stringvar txt2 := '';
shared stringvar txt3 := '';

txt1 := split(Split (tst,'=')[2],'&')[1];
txt2 := split(Split (tst,'=')[3],'&')[1];
txt3 := split(Split (tst,'=')[4],'&')[1];
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.032 seconds.