Hi Dovi ---
We'll solve this yet :-)
Let's see if I have this right. The customers are in a table called "long_distance" with the following significant fields:
code (which is the rate code 1..2...3..etc).
Theer is a view, view1, which I assume is a child of long_distance which contains the calls. A significant field in view1 is dialednr with is the number the customer dialed. So far correct?
Now, the rate table is (code,country,rate1,rate2,..raten)
I am assuming that "result" in your sample code is a time factor, like how many minutes?
And you need to solve a given rate for a given view1 record, right? Try this:
FUNCTION getrate()
PARAMETERS cDialednbr,cCode,nResult
cRateField="rates.rate"+cCode
IF LEFT(cDialednbr,1)="0"
SEEK LEFT(cDialednbr,6) TAG code IN rates
ELSE
SEEK LEFT(cDialednbr,4) TAG code IN rates
ENDIF
RETURN EVAL(cRateField) * nResult
Try this :-)
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05