Crystal Syntax Help

Hi Dustin,



You can use a simple formula to calculate how many 'values' along the
string your 4-digit number is:




Value index = Integer(Position in string / 5) + 1



For example, the value index of 4187 in the string "4185~4186~4187~4188"

= Integer(11 / 5) + 1


= Integer(2.2) + 1

= 2 + 1

= 3



Or, the value index of 4188 in the string "4185~4186~4187~4188"

= Integer(16 / 5) + 1


= Integer(3.2) + 1

= 3 + 1

= 4



All you need to do is use the correct Crystal syntax (I think someone
mentioned the Crystal function InStr() which will cover the Position in
string element of the formula).



I hope this helps,

Andy Watts.



________________________________________
From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
[mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On
Behalf Of melissa hietala
Sent: Thursday, June 17, 2010 11:53 AM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: [Vantage] Crystal Syntax Help


I have a string in the following format in crystal:
"4185~4186~4187~4188"

There is anywhere from 1 to 10 values in the string.

Say I would like to find the placement of the string "4187" in this
string. How would I return a value of 3? (being that "4187" is held in
the 3rd position of this string)

Hope this makes sense and any help is appreciated.

Thanks

Dustin Biniek
Andy Watts
IT Manager

Ripley Engineering Ltd
Tel: 01256-473940/464167
Mob:
www.ripley-eng.co.uk


[Non-text portions of this message have been removed]
I have a string in the following format in crystal: "4185~4186~4187~4188"

There is anywhere from 1 to 10 values in the string.

Say I would like to find the placement of the string "4187" in this string. How would I return a value of 3? (being that "4187" is held in the 3rd position of this string)

Hope this makes sense and any help is appreciated.

Thanks

 Dustin Biniek




[Non-text portions of this message have been removed]
Here's an example:

local stringvar x :="4185~4186~4187~4188";

local numbervar i:=0;

local numbervar FoundI;

for i := 0 to ubound(split(x,"~"))-1 do

(

if split(x,"~")[i+1]="4187" then FoundI:=i+1

);

FoundI



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of melissa hietala
Sent: Thursday, June 17, 2010 11:53 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Crystal Syntax Help





I have a string in the following format in crystal:
"4185~4186~4187~4188"

There is anywhere from 1 to 10 values in the string.

Say I would like to find the placement of the string "4187" in this
string. How would I return a value of 3? (being that "4187" is held in
the 3rd position of this string)

Hope this makes sense and any help is appreciated.

Thanks

Dustin Biniek

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]
Sean,

Very cool! This gets me half way there. Now I need to take the "position" that is returned from this statement, and find this same "position" in another statement that is setup the same way and return the value.

Example:

local stringvar x :="4185~4186~4187~4188";Â
When looking for string "4187" this returns a value of 3.

I need to take a second statement:Â "16~20~23~35"
Find the 3rd position (this is what we found in the previous statement), and return the value that is seen here.

So ultimately I would need to retrieve the value 23.

Any more thoughts on how that could be accomplished????

Thanks so much

Dustin Biniek




________________________________
From: Sean McDaniel <smcdaniel@...>
To: vantage@yahoogroups.com
Sent: Thu, June 17, 2010 11:13:15 AM
Subject: RE: [Vantage] Crystal Syntax Help

Â
Here's an example:

local stringvar x :="4185~4186~4187~4188";

local numbervar i:=0;

local numbervar FoundI;

for i := 0 to ubound(split(x,"~"))-1 do

(

if split(x,"~")[i+1]="4187" then FoundI:=i+1

);

FoundI

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of melissa hietala
Sent: Thursday, June 17, 2010 11:53 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Crystal Syntax Help

I have a string in the following format in crystal:
"4185~4186~4187~4188"

There is anywhere from 1 to 10 values in the string.

Say I would like to find the placement of the string "4187" in this
string. How would I return a value of 3? (being that "4187" is held in
the 3rd position of this string)

Hope this makes sense and any help is appreciated.

Thanks

Dustin Biniek

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]







[Non-text portions of this message have been removed]
local stringvar x :="4185~4186~4187~4188";

local numbervar i:=0;

local numbervar FoundI;

for i := 0 to ubound(split(x,"~"))-1 do

(

if split(x,"~")[i+1]="4187" then FoundI:=i+1

);

local stringvar x1:= "16~20~23~35";

if ubound(split(x1,"~"))>=FoundI then split(x1,"~")[FoundI] else "different array sizes"

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of melissa hietala
Sent: Thursday, June 17, 2010 12:41 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Crystal Syntax Help





Sean,

Very cool! This gets me half way there. Now I need to take the "position" that is returned from this statement, and find this same "position" in another statement that is setup the same way and return the value.

Example:

local stringvar x :="4185~4186~4187~4188";
When looking for string "4187" this returns a value of 3.

I need to take a second statement: "16~20~23~35"
Find the 3rd position (this is what we found in the previous statement), and return the value that is seen here.

So ultimately I would need to retrieve the value 23.

Any more thoughts on how that could be accomplished????

Thanks so much

Dustin Biniek

________________________________
From: Sean McDaniel <smcdaniel@... <mailto:smcdaniel%40comtecsolutions.com> >
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Sent: Thu, June 17, 2010 11:13:15 AM
Subject: RE: [Vantage] Crystal Syntax Help


Here's an example:

local stringvar x :="4185~4186~4187~4188";

local numbervar i:=0;

local numbervar FoundI;

for i := 0 to ubound(split(x,"~"))-1 do

(

if split(x,"~")[i+1]="4187" then FoundI:=i+1

);

FoundI

From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> [mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On Behalf
Of melissa hietala
Sent: Thursday, June 17, 2010 11:53 AM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: [Vantage] Crystal Syntax Help

I have a string in the following format in crystal:
"4185~4186~4187~4188"

There is anywhere from 1 to 10 values in the string.

Say I would like to find the placement of the string "4187" in this
string. How would I return a value of 3? (being that "4187" is held in
the 3rd position of this string)

Hope this makes sense and any help is appreciated.

Thanks

Dustin Biniek

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]
Works like a charm. Thanks for your help!
Â




________________________________
From: Sean McDaniel <smcdaniel@...>
To: vantage@yahoogroups.com
Sent: Thu, June 17, 2010 11:50:05 AM
Subject: RE: [Vantage] Crystal Syntax Help

Â
local stringvar x :="4185~4186~4187~4188";

local numbervar i:=0;

local numbervar FoundI;

for i := 0 to ubound(split(x,"~"))-1 do

(

if split(x,"~")[i+1]="4187" then FoundI:=i+1

);

local stringvar x1:= "16~20~23~35";

if ubound(split(x1,"~"))>=FoundI then split(x1,"~")[FoundI] else "different array sizes"

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of melissa hietala
Sent: Thursday, June 17, 2010 12:41 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Crystal Syntax Help





Sean,

Very cool! This gets me half way there. Now I need to take the "position" that is returned from this statement, and find this same "position" in another statement that is setup the same way and return the value.

Example:

local stringvar x :="4185~4186~4187~4188";
When looking for string "4187" this returns a value of 3.

I need to take a second statement: "16~20~23~35"
Find the 3rd position (this is what we found in the previous statement), and return the value that is seen here.

So ultimately I would need to retrieve the value 23.

Any more thoughts on how that could be accomplished????

Thanks so much

Dustin Biniek

________________________________
From: Sean McDaniel <smcdaniel@... <mailto:smcdaniel%40comtecsolutions.com> >
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Sent: Thu, June 17, 2010 11:13:15 AM
Subject: RE: [Vantage] Crystal Syntax Help


Here's an example:

local stringvar x :="4185~4186~4187~4188";

local numbervar i:=0;

local numbervar FoundI;

for i := 0 to ubound(split(x,"~"))-1 do

(

if split(x,"~")[i+1]="4187" then FoundI:=i+1

);

FoundI

From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> [mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On Behalf
Of melissa hietala
Sent: Thursday, June 17, 2010 11:53 AM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: [Vantage] Crystal Syntax Help

I have a string in the following format in crystal:
"4185~4186~4187~4188"

There is anywhere from 1 to 10 values in the string.

Say I would like to find the placement of the string "4187" in this
string. How would I return a value of 3? (being that "4187" is held in
the 3rd position of this string)

Hope this makes sense and any help is appreciated.

Thanks

Dustin Biniek

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]




[Non-text portions of this message have been removed]







[Non-text portions of this message have been removed]
Dustin,

Without some deep coding getting, returning a "3" since 4187 is the third "chunk" in that string will be difficult.

You can, however, very easily get the string position of 4187 with the InStr() function.

Hit F1 in Crystal Reports and search for InStr().

That should get you close.

________________________________________
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of melissa hietala
Sent: Thursday, June 17, 2010 11:53 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Crystal Syntax Help

Â
I have a string in the following format in crystal: "4185~4186~4187~4188"

There is anywhere from 1 to 10 values in the string.

Say I would like to find the placement of the string "4187" in this string. How would I return a value of 3? (being that "4187" is held in the 3rd position of this string)

Hope this makes sense and any help is appreciated.

Thanks

 Dustin Biniek

[Non-text portions of this message have been removed]
Dustin,



This will return 3



stringvar YourString;

stringvar array YourArray;

numbervar i;

stringvar StringToSearchFor;

numbervar Location;

YourString := "4185~4186~4187~4188";

StringToSearchFor := "4187";

YourArray := split(YourString,"~");

for i := 1 to ubound(YourArray) do

if YourArray[i] = StringToSearchFor then

Location := i

;

;

Location;



Hth,

Linda



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Vic Drecchio
Sent: Thursday, June 17, 2010 12:09 PM
To: vantage@yahoogroups.com
Cc: kevmel822@...
Subject: RE: [Vantage] Crystal Syntax Help





Dustin,

Without some deep coding getting, returning a "3" since 4187 is the third "chunk" in that string will be difficult.

You can, however, very easily get the string position of 4187 with the InStr() function.

Hit F1 in Crystal Reports and search for InStr().

That should get you close.

________________________________________
From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> [mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On Behalf Of melissa hietala
Sent: Thursday, June 17, 2010 11:53 AM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: [Vantage] Crystal Syntax Help


I have a string in the following format in crystal: "4185~4186~4187~4188"

There is anywhere from 1 to 10 values in the string.

Say I would like to find the placement of the string "4187" in this string. How would I return a value of 3? (being that "4187" is held in the 3rd position of this string)

Hope this makes sense and any help is appreciated.

Thanks

Dustin Biniek

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]
Â
Use the Split Function in Crystal and specify the number in the array process, this will return the value you need.
Â
Syntax
Â
split("Your String","~")[3]
Â
Thanks,
Doma.
Â

--- On Tue, 6/22/10, Linda Lowney <llowney@...> wrote:


From: Linda Lowney <llowney@...>
Subject: RE: [Vantage] Crystal Syntax Help
To: vantage@yahoogroups.com
Date: Tuesday, June 22, 2010, 12:26 PM


Â



Dustin,



This will return 3



stringvar YourString;

stringvar array YourArray;

numbervar i;

stringvar StringToSearchFor;

numbervar Location;

YourString := "4185~4186~4187~4188";

StringToSearchFor := "4187";

YourArray := split(YourString,"~");

for i := 1 to ubound(YourArray) do

if YourArray[i] = StringToSearchFor then

Location := i

;

;

Location;



Hth,

Linda



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Vic Drecchio
Sent: Thursday, June 17, 2010 12:09 PM
To: vantage@yahoogroups.com
Cc: kevmel822@...
Subject: RE: [Vantage] Crystal Syntax Help





Dustin,

Without some deep coding getting, returning a "3" since 4187 is the third "chunk" in that string will be difficult.

You can, however, very easily get the string position of 4187 with the InStr() function.

Hit F1 in Crystal Reports and search for InStr().

That should get you close.

________________________________________
From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> [mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On Behalf Of melissa hietala
Sent: Thursday, June 17, 2010 11:53 AM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: [Vantage] Crystal Syntax Help


I have a string in the following format in crystal: "4185~4186~4187~4188"

There is anywhere from 1 to 10 values in the string.

Say I would like to find the placement of the string "4187" in this string. How would I return a value of 3? (being that "4187" is held in the 3rd position of this string)

Hope this makes sense and any help is appreciated.

Thanks

Dustin Biniek

[Non-text portions of this message have been removed]




[Non-text portions of this message have been removed]











[Non-text portions of this message have been removed]