Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count the number of semicolons (delimiters) in field

Status
Not open for further replies.

beauman

MIS
May 3, 2003
12
0
0
US
I have a field in a Progress table that contains multiple data separated by semicolons.
(609.47;861.38;1480.82;3192.54;5244)
Each position represents a different quantity price.
Fortunately in the same table I have another field called Quantity-number that contains a number that relates to the position in the other field.
(1) or (2) etc. The quantity-number is a representation of the position in the other field.
Quantity-number 1 is the first entry (609.47)
Quantity-number 2 is the second entry (861.38)
Quantity-number 3 is the third entry (1480.82)
I need to pull the number based on the Quantity-number. I have no idea how to accomplish this.

 
I have tried
whileprintingrecords;
numbervar array QtyNO := split({JobEstMerge.Quantity-Number},";")
I get an error that a string is required here.
 
You could try something like this:

Create a formula {@qtyprice}:

stringvar array qtyprice := split({table.string},";");

if {table.qtyno} = 1 then stringvar array qtyprice [1] else
if {table.qtyno} = 2 then stringvar array qtyprice [2] else
if {table.qtyno} = 3 then stringvar array qtyprice [3] else ""

-LB
 
Sorry, our posts crossed. I assumed that {table.qtyprice} was a string. The split function I think requires a string. Can you verify the data type? Also, I think you mean to use the split function on {table.qtyprice} not {table.qtyno}. Doesn't {table.qtyno} return one discrete value?

-LB
 
You are absolutely correct. I spend most of the weekend trying to learn how to write against Progress Tables.

{Quantity-number} data type is integer inte with a format of 9
the quantity-number represents the position in laborPrice
2=861.38


{LaborPrice} data type is listed as a decimal deci-2[5] with a format of ZZ,ZZZ,zz9.99
(609.47;861.38;1480.82;3192.54;5244)
 
I am sorry
When I browse the table it tells me that LaborPrice is a String.
Length 140
With an example 0;0;0;0;0.

When I print out the Table Description it tells me that Labor Price is an deci-2[5]
 
So my earlier suggestion should work--I changed the field names a little to correspond more to yours, but still you would need to substitute your exact fields.

Create a formula {@lbrprice}:

stringvar array lbrprice := split({table.laborprice},";");

if {table.qtyno} = 1 then stringvar array lbrprice [1] else
if {table.qtyno} = 2 then stringvar array lbrprice [2] else
if {table.qtyno} = 3 then stringvar array lbrprice [3] else ""

Let me know if this doesn't work for some reason.

-LB
 
You might simplify this a bit:

val((split({table.LaborPrice},";")[{table.Quantity-number}]))

-k
 
Thanks much. There aren't very many people who I can turn to for help with Crystal and Progress. In fact, this site is my only resource. I spend a lot of time trying to do things that my boss thinks are easy. I appreciate your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top