Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: extract or split a field Post Reply Post New Topic
<< Prev Page  of 3 Next >>
Author Message
Schugs
Newbie
Newbie


Joined: 08 Aug 2012
Online Status: Offline
Posts: 36
Quote Schugs Replybullet Posted: 06 Feb 2013 at 11:40am
left(totext({?PSampleType}),instr(totext({?PSampleType})," - ")-1)
IP IP Logged
Schugs
Newbie
Newbie


Joined: 08 Aug 2012
Online Status: Offline
Posts: 36
Quote Schugs Replybullet Posted: 06 Feb 2013 at 11:44am
Curious when you are creating the new Parameter what does it say the "type" is between the Name and Dynamic fields at the top?

IP IP Logged
Laguna
Newbie
Newbie


Joined: 20 Sep 2012
Online Status: Offline
Posts: 17
Quote Laguna Replybullet Posted: 06 Feb 2013 at 11:48am

It says String

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Feb 2013 at 11:49am
what is sample data you are comparing the paramter to?
Is you paramter se to allow fo rmultiple selections?
IP IP Logged
Schugs
Newbie
Newbie


Joined: 08 Aug 2012
Online Status: Offline
Posts: 36
Quote Schugs Replybullet Posted: 06 Feb 2013 at 11:53am
Originally posted by DBlank

what is sample data you are comparing the paramter to?
Is you paramter se to allow fo rmultiple selections?


I Fail. lol, Didn't think of it being an array.
IP IP Logged
Laguna
Newbie
Newbie


Joined: 20 Sep 2012
Online Status: Offline
Posts: 17
Quote Laguna Replybullet Posted: 06 Feb 2013 at 11:53am
I haven't compared the sample data yet. I need to separate materialnames and materialtypes from {?PSampleType} so I can do the comparison.
 
Yes the parameter is set to allow for multiple selections.
IP IP Logged
Schugs
Newbie
Newbie


Joined: 08 Aug 2012
Online Status: Offline
Posts: 36
Quote Schugs Replybullet Posted: 06 Feb 2013 at 12:00pm
then it is creating an array, essentially

{?PSampleType} = ["Wood - Plywood","Steel - Stainless"]

meaning if you want to find all records where (material type = wood and name = plywood) or (material type = steel and name = stainless" then you are going to have to break the array into sub parts. that would be very heavy on the database, the other option is if you are only looking for Wood - Plywood and not any kind of wood, then you could just splice the strings together just as the sql does for the list i.e.

local stringvar FullName := {table.materialtype} & " - " & {table.materialname};
fullname in {?PSampleType}
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Feb 2013 at 12:04pm

I am not sure how to split something that is already an array ans use it in the select statement and you cannot use LIKE or instr() on it.

Are you stuck with the concantenated field or can you create two different params to choose the fields as seperate options? or can you just create one static list that allows you to select each type seperately?
IP IP Logged
Laguna
Newbie
Newbie


Joined: 20 Sep 2012
Online Status: Offline
Posts: 17
Quote Laguna Replybullet Posted: 06 Feb 2013 at 12:04pm

I'm still new to crystal so please pardon my inexperience...

this looks like it is headed in the right direction...
local stringvar FullName := {table.materialtype} & " - " & {table.materialname};
fullname in {?PSampleType}
Would this go into a formula? Or directly in the select statement?
IP IP Logged
Schugs
Newbie
Newbie


Joined: 08 Aug 2012
Online Status: Offline
Posts: 36
Quote Schugs Replybullet Posted: 06 Feb 2013 at 12:06pm
select statement
IP IP Logged
<< Prev Page  of 3 Next >>
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.012 seconds.