Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Anybody ca help mecall a function to evaluate cell in g
Message
From
27/06/1999 23:33:38
Dovi Gilberd
Dovtware Consulting Inc
Miami, Florida, United States
 
 
To
27/06/1999 19:26:29
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Visual ProMatrix
Miscellaneous
Thread ID:
00232180
Message ID:
00234615
Views:
35
Thank you so much for listening to me...yes the program its giving me now answer 23 which is wrong because its returning the number of fields plus one..
in general can you help me write the function from scratch and clear, because if spoken o many people but i cannot put it all together...please tell me what gos fist second and last...i can pay you for the services...visa or mc?
Thank you so much...Yes im very desperate...i have to complete this part of the program by tomorrow....






>Boy, are you desperate...
>
>OK, here's what you say:
>
>> i know that John doe has rate 2, and he made a call to 01157587654..
>> then that call with rate 2 to colombia should be billed at .24
>>
>> Now first i neeD to compare the first digits of the call against the rate table to see which country was called
>> then i need to compare long_distance.code (rate asigned) the correct column of rates table( meaning if john doe
>> had rate 3, make sure that it uses the fith column of rates table..
>> now that i know the rate and the country i could knwo the rate
>>
>>
>> im triying with this function to doit but its not working properly..
>> CAN YOU PLEASE HELP ME OUT.TO CORRECT THE FUNCTION SO IT WORKS PROPERLY..
>
>I'm assuming the code parameter is "1" for rate1, "2" for rate2 etc. You should be calling this function with
>rate("01157587654", "3", 32.4) (assuming John Doe spent 32.4 minutes talking to Colombia). You'd probably have to call it with your real fields, like rate(view1.dialednr, long_distance.code, view1.minutes).
>
>> function rate()
>
>* not sure you can put the same parameter twice. Never tried that and wouldn't know what happens
>
>> lparameter dialednr,code,result && ,result,n
>> select rates
>> set order to code
>
>> if dialednr starts with 0 then take left 6 of dialednr compared with rates.code
> if dialednr="0"
> if seek left(dialednr,6)
>
>* now watch this: since code parameter contains a "3", you'll get eval("rate3")
> return eval("rate"+code)*result
> else
> return 0
> endif
> else
>> if dialednr starts with 1 then take left 4 of dialednr compared with rates.code
> if seek left(dialednr,4)
> return eval("rate"+code)*result
> else
> return 0
> endif
> endif
>
>Now you got me confused with this part: if your inner For loop fails to match a field, you return the number of fields plus 1, which will, of course, be wrong.
>
>> rate=n
>> return rate
>> endfunc
>> return rate
>>
>
>You will also have to handle the cases where the country code can't be matched. I'm returning zeros in this case, but you could actually return .null. or something else, so you'll know that it failed in those cases, and be able to do some reporting about it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform