Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Anybody ca help mecall a function to evaluate cell in g
Message
De
28/06/1999 05:36:06
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
27/06/1999 23:33:38
Dovi Gilberd
Dovtware Consulting Inc
Miami, Floride, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual ProMatrix
Divers
Thread ID:
00232180
Message ID:
00234669
Vues:
25
>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?

Miami, eh? A dinner for the FFDB club next year, Devcon time... there are only four of us :) ...if this works.

>>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).

OK, here's the function, cleaned up. There were some errors on my side (like missing parentheses after Seek). I've also changed the names of the parameters, so they don't coincide with the actual names in the tables.

function rate
lparameter cDialednr,RateCode,quantity
set order to code in rates
*** if dialednr starts with 0 then take left 6 of dialednr compared with rates.code
if dialednr="0"
if seek(left(cDialednr,6), "rates")
return eval("rates.rate"+RateCode)*quantity
else
return 0
endif
else
** in all other cases assume first four digits are needed. You may actually have a separate case when the
** first digit is "1", and then take care of all the other cases, so you wouldn't have an outer IF ... Else...Endif
** but a Case ... EndCase instead
if seek(left(cDialednr,4), "rates")
return return eval("rates.rate"+RateCode)*quantity
else
return 0
endif
endif

Now when you call this function, it takes three parameters: the dialed number (you take it from view1), number of the rate passed as a string - so if it's a 3, you pass "3" (if it's a numeric in the Long_Distance table, you may send alltrim(str(long_distance.code, 3, 0)) to make it a proper string) and the third parameter is what you had originally named "result", which I assume is some sort of measure for the length of the call. So your function is called like this:

nAmountToCharge=rate(view1.DialedNr, alltrim(str(long_distance.code, 3, 0)), view1.LengthOfCall)

By the time you'll read this, it will be early Monday morning... hope you wake up on time, and hope it works.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform