Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: InStr Formula Help Post Reply Post New Topic
Author Message
jarrodj74
Newbie
Newbie
Avatar

Joined: 18 Jun 2013
Online Status: Offline
Posts: 2
Quote jarrodj74 Replybullet Topic: InStr Formula Help
     Posted: 18 Jun 2013 at 2:24pm
I have a CUD String that is being passed to me and I need to extract variables from it based on the prefix they start with.


name of string: {EZ_CONFIGURED_LINE_ITEM.CUD_STRING}

Data inside CUD_String (the following is just a small section as an example its an extremely long string)

USBottomLoadAdapters='Civacon891A',USPipeCouplers='Dixon; aluminum; 4in; Viton-A Gasket',USPipingBrakeInterlock='Bar interlock with castings; civacon valve',USPipingSystem='4in Piping',USPipingSystemValve='None',

I want to display the value for USPipecouplers

which is: 'Dixon; aluminum; 4in; Viton-A Gasket

What would this formula look like? I'm a Newby to Crystal Reports!
Thanks, Jarrod J
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 19 Jun 2013 at 3:39am
hi

Try this :

numbervar cnt;
numbervar cnt1;
cnt:=instr({@test1},'USPipeCouplers');
cnt1:=instr({@test1},'Viton-A Gasket');

Mid({@test},cnt,(cnt1-cnt)+14)
Thanks,
Sastry
IP IP Logged
jarrodj74
Newbie
Newbie
Avatar

Joined: 18 Jun 2013
Online Status: Offline
Posts: 2
Quote jarrodj74 Replybullet Posted: 28 Jun 2013 at 10:50am
That's Great! thank you. How would I take certain pieces out of the string? Like if i wanted to not show USPipeCouplers= and maybe take out the punctuation in the returned value?

Here is what comes back when I insert my table names:
USPipeCouplers-'Dixon; aluminum; 4in; Viton-A Gasket


Would like to extract:
Dixon Aluminum 4in Viton-A Gasket

Thanks, Jarrod J
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Jul 2013 at 5:17am
just adjust sastry's formula to this
 
numbervar start;
numbervar end;
start:=instr({@field},'USPipeCouplers')+16;
end:=instr(instr({@field},"USPipeCouplers='") + 16,{@1},"'")-start;

Mid({@field},start,end)

IP IP Logged
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