Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with date based index
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00580327
Message ID:
00580330
Views:
17
Your problem appears to be in the Index, not as such in the code...
You have
STR({^3000/01/01}-EFFDATE)
in your index expression, this wont work, STR only converts numbers to strings, not dates.

Look at DTOS() and DTOC() and choose which is best suited for you.

- Chris

>Hi
>
>I am developing an work order system. Each product/Service has a price based on the effective date (i.e. the price becomes effective on a certain date)
>
>I wrote the following function in the 'Stored Procedures' section for the database. WOTS.dbc
>
>PROCEDURE relCurrPrice
>LPARAMETERS cPrSched, cPcode
>*
>* find the current price in price schedule = cPrSched
>* for product/service = cPcode
>*
>LOCAL cSeekKey
>cSeekKey = cPrSched+cPcode+STR({^3000/01/01}-DATE())
>cSaveAlias=ALIAS()
>
>SELECT SPECPRICE
>SET ORDER TO 1 && PRSCHED+CODE+STR({^3000/01/01}-EFFDATE)
>cSaveFilter = FILTER()
>SET FILTER TO prsched=cPrsched AND code=cPcode
>
>lFound=INDEXSEEK(cSeekkey,.T.)
>IF !lFound
> SKIP -1
> IF EOF()
> lFound = .F. && No record for this Pcode
> ELSE
> lFound = .T. && We are on the current price
> ENDIF
>ENDIF
>* Restore entry state
>SET FILTER TO &cSaveFilter
>SELECT (cSaveAlias)
>
>RETURN lFound
>ENDPROC
>
>**********************
>I added the parent 'PRODSERV' and child 'SPECPRICE' tables and
>set the RelationExpression to 'relCurrPrice(prsched,code)'
>
>I then added some test fields from each table to a test form.
>
>The relationship expression gets fired and finds the correct record
>but I then get an 'error 67' 'expression evaluator failed' in 'DataEnvironment.OpenTables' method.
>
>Obviously I am doing something wrong. can someone please point me in the correct direction.
>
>Ta very muchly
>Geoff Scott
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform