I have created a numeric field(expense (N6.2)) to hold data that involves money both in dollars and cents(like: $234.70).However the requirement is to separate them into their respective fields,like "234" in another field and "70" in another field.
I already converted the numeric field(namely expense) into a character field (namely expenses) using the STR() function.
I created two fields,one to hold the "dollar" part and the other for the "cents" part.
And now I would like to get the dollar part and insert into the new field "dollar".here is the code:
replace dollar with substr(expenses,1,3)
It is working well for 3 digits dollar part, data like $367.80,$893.60 but not for 2 or 1 digits dollar part, data like $78.00,$1.45,$3.50 and so forth.
I am thinking of using the FOR loop so as the FOR loop moves through the string it stops when it encounters the decimal point and replaces the dollar field with the numbers that are before the decimal point.
Could anyone help me out with this problem or just give me some clue so I can work around it.
Thankyou in advance.
Yanx
I already converted the numeric field(namely expense) into a character field (namely expenses) using the STR() function.
I created two fields,one to hold the "dollar" part and the other for the "cents" part.
And now I would like to get the dollar part and insert into the new field "dollar".here is the code:
replace dollar with substr(expenses,1,3)
It is working well for 3 digits dollar part, data like $367.80,$893.60 but not for 2 or 1 digits dollar part, data like $78.00,$1.45,$3.50 and so forth.
I am thinking of using the FOR loop so as the FOR loop moves through the string it stops when it encounters the decimal point and replaces the dollar field with the numbers that are before the decimal point.
Could anyone help me out with this problem or just give me some clue so I can work around it.
Thankyou in advance.
Yanx