Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Matrix rate
Message
From
29/06/1999 13:06:43
Dovi Gilberd
Dovtware Consulting Inc
Miami, Florida, United States
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00233562
Message ID:
00235344
Views:
24
hi barbara how are you..can you believe im still stock in this
im using this function that ed helped me with..but its not working
one...i know a customer has 5 calls. 2 to 411 and 3 long distance that start with 0111
only the two for 411 show up..
on another customer that only has 0111 calls long distance about 300 no one shows up iun the grid....well...the showup for a sec and then desapear and then all the fields on that customer appear asl disables.
the other erroo is that when the calls appear for a sec i can see that the lnresult is 0.. can you please revise this code to see if there is anything wrong..PLEASE

FUNCTION GetRate
LOCAL lcInAlias, lcSeekValue, lcCheckDigit, lcAssertSetting, llFoundPrefix, lnResult
lcInAlias = ALIAS() && save the currently selected work area
lcAssertSetting = SET('ASSERTS') && and the SET ASSERTS mode
lcSeekValue = NULL &&default seek value to NULL
lnResult = NULL &&default result to NULL
llFoundPrefix = .F. &&And by default the seek failed
SET ASSERTS ON && enable asserts
IF ! USED('long_distance')
* if the lookup table isn't in use already in this datasession, open it
USE long_distance IN 0 SHARED && make sure the table is in use
ENDIF
SELECT long_distance && Select the lookup table before trying to find in it
SET ORDER TO resellerid &&is correct && in the right sort order
*
* I use a local variable so that the LEFT() function is only called once,
* and the code becomes a tad clearer in the DO CASE
*
lcCheckDigit = LEFT(view1.dialednr,1)
* Check how many characters to use for lookup based on first character
DO CASE
CASE lcCheckDigit = '1'
lcSeekValue = LEFT(view1.dialednr,4)
CASE lcCheckDigit = '0'
lcSeekValue = LEFT(view1.dialednr,6)
CASE lcCheckDigit = '#'
lcSeekValue = LEFT(view1.dialednr,3)
CASE LEFT(view1.dialednr,3) == "411"
* 411 calls cost $0.75 each
lnResult = .75
CASE LEFT(view1.dialednr,3) == "911"
* 911 calls cost $0.00 each
lnResult = 0.00
**CASE LEN(ALLTRIM(CHRTRAN(view1.dialednr,"-",""))) < 7
** lnResult = 0

OTHERWISE
* Oops - the dialednr isn't in the form we expected - use an ASSERT
* to let us know an error occurred while developing, to let us go
* into the debugger when the error occurs. ASSERT gives us a message
* telling us what we think went wrong as a part of the statement
*ASSERT .F. MESSAGE 'Lead dialednr character "' + lcCheckDigit + '" not supported!'
lnResult = 0
ENDCASE
IF ! ISNULL(lcSeekValue)
* the dialednr started with a valid character, so try to find the prefix
* we grabbed from our rate table
llFoundPrefix = SEEK(lcSeekValue)
ENDIF
IF llFoundPrefix
* found it - save the rate we found!
lnResult = long_distance.rate
ELSE
* oops - not in our lookup table - use ASSERT to let me know
* what went wrong
*ASSERT ! ISNULL(lcSeekValue) MESSAGE 'Cound not find number prefix "' + lcSeekValue +'" in long_distance table'
ldresult=0
ENDIF
*Restore the initially-selected work area and the ASSERT setting
IF ! EMPTY(lcInAlias)
SELECT (lcInAlias)
ELSE
SELECT 0
ENDIF
SET ASSERTS &lcAssertSetting
RETURN lnResult
Previous
Reply
Map
View

Click here to load this message in the networking platform