Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with VFP 6 and dates
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00198872
Message ID:
00199826
Views:
26
>>>>Hi,
>>>>
>>>>I just upgraded VFP to the new 6.0 version (without the Service Pack yet) and got an error when running my application (I´m still using version 3.02 of the framework). I have a View that needs to be ordered by type of document (ascending) and documents of the same type must be ordered by date of document (descending). So I created an index on "od_tipo_documento + STR({31/12/2100} - dt_documento, 5)" and it was working fine. Now, with 6.0, I had to change the ambiguous date to "od_tipo_documento + STR({^2100-12-31} - dt_documento, 5)". Now I receive an error :
>>>>
>>>>Index does not match the table. Delete the index file and re-create the index (Error 114)
>>>>
>>>>??????????
>>>>
>>>>Any tips ?
>>>>
>>>>Regards,
>>>
>>>José,
>>>
>>>I played a while with this:
>>>
>>>SET DATE FRENCH
>>>? {31/12/2100} = {^2100-12-31} gives .T.
>>>SET DATE AMERICAN
>>>? {31/12/2100} = {^2100-12-31} gives .F.
>>>SET DATE FRENCH
>>>? {31/12/2100} - DATE() gives 0 (not right, by my standards...)
>>>? {^2100-12-31} - DATE() gives 37178 (seems mor trustable...)
>>>
>>>Do you mean you changed the index at the table level or at the view level. If it's in the view, it should do no harm, since the index disappears with the view.
>>>
>>>José
>>
>>This is happening in aDataEnv.prg, indexing the View. I know that the index file created by a View indexing is temporary, but I get the error anyway. The code is :
>>
>>*-------------------------------------
>>*--- TitularesDocumentosEnvironment
>>*--- Used in frmTitulares
>>*-------------------------------------
>>DEFINE CLASS TitularesDocumentosEnvironment AS SPIEnvironment
>> FUNCTION LoadCursors()
>> DIMENSION this.aCursors[2]
>> this.aCursors[1] = 'v_Titulares_Documentos'
>> this.aCursors[2] = 'v_Titulares_Documentos_Todos'
>> ENDFUNC
>> FUNCTION PostInitHook()
>> LOCAL lcIndexExpr
>> lcIndexExpr = 'INDEX ON STR({^2100-12-31} - dt_documento, 5) TAG DATA'
>> This.CreateIndex('v_Titulares_Documentos',lcIndexExpr)
>> lcIndexExpr = 'INDEX ON TiraAcento(UPPER(LEFT(rf_documento, 50))) TAG REFERENCIA'
>> This.CreateIndex('v_Titulares_Documentos',lcIndexExpr)
>> lcIndexExpr = 'INDEX ON nu_registro TAG REGISTRO'
>> This.CreateIndex('v_Titulares_Documentos',lcIndexExpr)
>> lcIndexExpr = 'INDEX ON LEFT(nu_registro, 5) TAG REGISTRO'
>> This.CreateIndex('v_Titulares_Documentos_Todos',lcIndexExpr)
>> lcIndexExpr = 'INDEX ON od_tipo_documento + ' +;
>> 'STR({^2100-12-31} - dt_documento, 5) TAG TIPO'
>> This.CreateIndex('v_Titulares_Documentos',lcIndexExpr)
>> ENDFUNC
>>ENDDEFINE
>
>José,
>
>I don't use the CreateIndex function, still doing everything by hand. Could you try in the following fashion?
>
>DEFINE CLASS SalDivBrutEnvironment AS PROSALEnvironment
> FUNCTION LoadCursors()
> DIMENSION this.aCursors[2]
> this.aCursors[1] = 'v_SalDivBrut'
> this.aCursors[2] = 'v_cboDivBrut'
> ENDFUNC
>
> FUNCTION INIT()
> LOCAL luRetVal, ;
> lnSelect
> luRetVal = EVAL(this.ParentClass+"::Init()")
> lnSelect = SELECT()
> SELECT v_cboDivBrut
> INDEX ON cLibelle TAG libelle
> SET ORDER TO TAG libelle
> SELECT (lnSelect)
> ENDFUNC
>
>ENDDEFINE
>
>José

Did not work. Same error. Do you know another way to index a date in descending order ? I´ll post a message in another forum.

What I did :

DEFINE CLASS TitularesDocumentosEnvironment AS SPIEnvironment
FUNCTION LoadCursors()
DIMENSION this.aCursors[2]
this.aCursors[1] = 'v_Titulares_Documentos'
this.aCursors[2] = 'v_Titulares_Documentos_Todos'
ENDFUNC

FUNCTION Init()
LOCAL luRetVal, lnSelect
luRetVal = EVAL(This.ParentClass+"::Init()")
lnSelect = SELECT()
SELECT v_Titulares_Documentos
INDEX ON STR({^2100-12-31} - dt_documento, 5) TAG DATA
INDEX ON TiraAcento(UPPER(LEFT(rf_documento, 50))) TAG REFERENCIA
INDEX ON nu_registro TAG REGISTRO
INDEX ON od_tipo_documento + STR({^2100-12-31} - dt_documento, 5) TAG TIPO
SET ORDER TO TAG TIPO
SELECT (lnSelect)
ENDFUNC

ENDDEFINE
José Augusto Cavalcanti
Global Connection
jose.cavalcanti@globalconnection.com.br
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform