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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need formating help.

Status
Not open for further replies.

rkb0378

IS-IT--Management
Mar 12, 2002
16
US
Can anyone suggest a formula for the following?

I have a field that has the following information “1,704,000,000,000,000.00”. This field is combing multiple values. I am interested in only the second position where the 704 is located. How do I only show the second data position?

Thanks
 
“1,704,000,000,000,000.00” I am interested in only the second position where the 704 is located.

I am not certain what you are asking 4...the second position in this string is "," ... not 704. Are you looking for the "trillions" portion of this number represented by this string? Is this string always this size and format? Are you looking for the first number to the right of the first comma in the string?

You will have to be more specific as to what you are looking for?

Jim
 
Jim,

I guess the Information I am looking is in the trillions position.

Thanks

Rob
 

ok...so we want the trillions portion of
“1,704,000,000,000,000.00”

we should probably make a generic formula to get any portion of the number... with a parameter to determine if we want the trillions,billions,millions,thousands or hundreds portion of a number

@calcPortion
whileprintingrecords;
//in general it would be stringVar x := {Table.strValue}
stringVar x := “1,704,000,000,000,000.00”;
numberVar numLength;
stringVar result;

//remove the decimal portion and the commas if they exist

x := totext(tonumber(x),0,"","");

numlength := length(x)

if {?Param} = "Trillions" and numlength > 12 then
(if numlength > 15 then
result := mid(x,numlength - 14,3)
else
result := left(x,numlength - 12);
)
else
result := ""

if {?Param} = "Billions" and numlength > 9 then
(if numlength > 12 then
result := mid(x,numlength - 11,3)
else
result := left(x,numlength - 9);
)
else
result := ""

if {?Param} = "millions" and numlength > 6 then
(if numlength > 9 then
result := mid(x,numlength - 8,3)
else
result := left(x,numlength - 6);
)
else
result := ""


(..... and so on .....)


I think that will work for you

Jim


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top