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

Break Large Number into Smaller Segments 1

Status
Not open for further replies.
Jun 13, 2001
2
US
Hi! I'm writing a report that requires me to break apart a large 36 digit budget number into seven fields. For example, starting from the left the first four digits would fall into field #1 (company code), the next four would be field #2 (location), the next five would be field #3 (Cost Center), etc.

I'm somewhat of a novice at Crystal, though I've written a dozen or so reports over the last couple of years, most have been rather straight forward data extraction. Any help would be gratefully appreciated.

Bob
 
if the digit field is a string field you can use the following function:

Formula field example:
@company code:
mid({BudgetNumber},1,4)
The first number represents the starting point, the second number represents the number of characters it has to include.
I you want to use this string as a number to calculate data you can use the ToNumber function:
ToNumber(mid{BudgetNumber},1,4)

If the digit field is a number you can use the following function:

Dont know yet :s

Tanja
 
If the budget number IS a number, you can use:

mid(totext({table.budgetnumber}),1,4)

To make it a number, you can then use:

val(mid(totext({table.budgetnumber}),1,4))

Or you can use the tonumber() function.

-LB
 
Thanks Tanja & LB for taking the time to answer my question. The budget number is a string and Tanja's solution worked pefectly!

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top