Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Pulling a value from an array Post Reply Post New Topic
Author Message
TryingToUse
Newbie
Newbie


Joined: 13 Jun 2008
Location: United States
Online Status: Offline
Posts: 2
Quote TryingToUse Replybullet Topic: Pulling a value from an array
    Posted: 13 Jun 2008 at 8:59am
I am new to Crystal and need to do the following:
 
I have a field that contains 3 values for each row.  For example:
 
1  Start  sysadmin
2  Write  wr1
3  End  sysadmin
4  Start  sysadmin
 
What I want to do is to pull out the second value to display on the report (i.e., Start, Write, End, Start).  One value per row.
 
I setup the following formula:
 
Local StringVar Owner;
Local StringVar Array OwnerArrayVar;
OwnerArrayVar := Split ({Project.Current_Routing}, " ");
Owner = (OwnerArrayVar [2]);
 
What I get back is "True" for some of the rows and blank for the rest.
IP IP Logged
saoco77
Senior Member
Senior Member


Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
Quote saoco77 Replybullet Posted: 16 Jun 2008 at 5:30am
I think you are on the right track with this approach.

Try something like this in the formula field.

(split({table.field}," "))[2]

Hope this helps

Sarah

IP IP Logged
TryingToUse
Newbie
Newbie


Joined: 13 Jun 2008
Location: United States
Online Status: Offline
Posts: 2
Quote TryingToUse Replybullet Posted: 16 Jun 2008 at 9:29am
Sarah,
 
Thanks for the feedback.  After playing around with it for a bit more, this is what I found worked.
 
 
Local StringVar Owner;
Local StringVar Array OwnerArrayVar;
OwnerArrayVar := Split ({Project.Current_Routing}, " ");
Owner := OwnerArrayVar [3];
 
I thought the blank would be a separator only but it was part of the array as well.  I thought I had 3 values as part of the array but I had 5 including the 2 blank spaces.
 
Problem solved!
 
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.012 seconds.