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
Author Message
Laguna
Newbie
Newbie


Joined: 20 Sep 2012
Online Status: Offline
Posts: 17
Quote Laguna Replybullet Posted: 06 Feb 2013 at 12:08pm
We'll probably have to create two different parameters for this. We did this concatenation to make it easier for users, but now it's difficult for us to figure out how to split.
We had static lists but need to go to dynamic lists.
 
Thanks for your time! Much appreciated!
IP IP Logged
Schugs
Newbie
Newbie


Joined: 08 Aug 2012
Online Status: Offline
Posts: 36
Quote Schugs Replybullet Posted: 06 Feb 2013 at 12:19pm
Originally posted by DBlank

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?


Simply food for thought DBlank, what about something like this used in a formula, then have the select formula match this.

local numbervar x;
local booleanvar match:=false;

for x :=1 to UBound({?PSample})
(
    if {table.Material}=Left({?psampletype}[x],instr({?psampletype}[x])-1)
        and {table.type}=right({?psampletype}[x],len({?psampletype}[x])-instr({?psampletype}[x])+3) then
        match := true
);

match

Edited by Schugs - 06 Feb 2013 at 12:21pm
IP IP Logged
Schugs
Newbie
Newbie


Joined: 08 Aug 2012
Online Status: Offline
Posts: 36
Quote Schugs Replybullet Posted: 06 Feb 2013 at 12:24pm
Originally posted by Laguna

We'll probably have to create two different parameters for this. We did this concatenation to make it easier for users, but now it's difficult for us to figure out how to split.
We had static lists but need to go to dynamic lists.

 

Thanks for your time! Much appreciated!



well while i do like for sake o know-how to find ways to work it, and i think we could, the path we are headed down is going to strain your DB quite a bit, testing every possible material against how ever many are in selected. Though, as a note, i do not think you can have multiple selections of different types of material if you have them as 2 parameters.
IP IP Logged
Laguna
Newbie
Newbie


Joined: 20 Sep 2012
Online Status: Offline
Posts: 17
Quote Laguna Replybullet Posted: 06 Feb 2013 at 12:32pm
i'll have to look into our selection more, but our database admin confirmed options like this in our list are correct...
MATERIALNAME1 - MATERIALTYPE1
MATERIALNAME1 - MATERIALTYPE2
MATERIALNAME2 - MATERIALTYPE3
MATERIALNAME2 - MATERIALTYPE4
MATERIALNAME3 - MATERIALTYPE5
MATERIALNAME4 - MATERIALTYPE5
 
thanks
IP IP Logged
Schugs
Newbie
Newbie


Joined: 08 Aug 2012
Online Status: Offline
Posts: 36
Quote Schugs Replybullet Posted: 06 Feb 2013 at 12:41pm
did using something like

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


not work? I tested it on my side and it should work ok. What error were you getting?

*edit* In my first post i had the name and type backwards if you didn't correct the order then it would not have found it.

Edited by Schugs - 06 Feb 2013 at 12:43pm
IP IP Logged
Laguna
Newbie
Newbie


Joined: 20 Sep 2012
Online Status: Offline
Posts: 17
Quote Laguna Replybullet Posted: 06 Feb 2013 at 12:52pm
honestly i'm still trying to figure out how to put this in my select statement. It's asking for a boolean here...
local stringvar FullName := {NAI_SAMPLES.MATERIAL_NAME} & " - " & {NAI_SAMPLES.MATERIAL_TYPE}
IP IP Logged
Schugs
Newbie
Newbie


Joined: 08 Aug 2012
Online Status: Offline
Posts: 36
Quote Schugs Replybullet Posted: 06 Feb 2013 at 12:56pm
Originally posted by Laguna

honestly i'm still trying to figure out how to put this in my select statement. It's asking for a boolean here...
local stringvar FullName := {NAI_SAMPLES.MATERIAL_NAME} & " - " & {NAI_SAMPLES.MATERIAL_TYPE}



you need to be sure to put the ";" at the end of that line and have

fullname in {?PSampleType} on the second line


another option would be to make a formula named "Fullname" and in it have the

{NAI_SAMPLES.MATERIAL_NAME} & " - " & {NAI_SAMPLES.MATERIAL_TYPE}

then in the select formula you can have
{@Fullname} in {?Psampletype}


that will accomplish the same thing.

Edited by Schugs - 06 Feb 2013 at 12:58pm
IP IP Logged
Laguna
Newbie
Newbie


Joined: 20 Sep 2012
Online Status: Offline
Posts: 17
Quote Laguna Replybullet Posted: 06 Feb 2013 at 1:08pm
yes it's there. Also noticed that the table i'm pulling from is using the synonym name of another table so having trouble adding the correct field from the correct table.
i'll have to continue in the morning.
 
Thank you so much
IP IP Logged
Laguna
Newbie
Newbie


Joined: 20 Sep 2012
Online Status: Offline
Posts: 17
Quote Laguna Replybullet Posted: 12 Feb 2013 at 4:47am
Hello again, i'm still working on this issue. Hopefully someone can continue to help me.
Overview: I concatenated 2 fields MaterialName with MaterialType and called it SampleType (MaterialName - MaterialType), to help users choose in the dynamic parameter.
Now I need to extract the MaterialName and MaterialType to use in the select statement.
 
I am able to split and extract out the MaterialName and MaterialType from the concatenated SampleType by using split({?PSampleType}[1]," - ")[1].
 
split({?PSampleType}[1]," - ")[1] gives me the MaterialName from the first SampleType
split({?PSampleType}[1]," - ")[2] gives me the MaterialType from the first SampleType
split({?PSampleType}[2]," - ")[1] gives me the MaterialName from the second SampleType
split({?PSampleType}[2]," - ")[2] gives me the MaterialType from the second SampleType
 
Could someone help me figure out how to work the array for multiple (>400)  SampleTypes instead of hard coding? Some users choose one SampleType, some users will choose many (>400) SampleTypes. 
 
Thanks
IP IP Logged
<< Prev Page  of 3
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.047 seconds.