Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
View Definition has been changed
Message
From
11/09/2007 15:43:54
 
 
To
11/09/2007 14:58:17
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01253748
Message ID:
01253767
Views:
20
>>I have one view that is based on two tables (supose table A and table B). My form uses this view in one grid to insert,update and delete records on table A. Everything was working correct until I issued zap on table A. After that when I call the form I receive the message "View Definition has been changed". This message occurs because I have requery(myview) in init method of the form. I do not use the zap command on the form, I have used just once to initialize the table and to restart my application.
>>
>>I have tried to recompiled the application, to recreate de view but the error continues.
>
>Some columns can have, when no data is pulled, different widths from those when there are data. It's the same as with any other SQL select - if the first record has short values, VFP may create a cursor with shorter fields.
>
>Since in VFP8 you don't have the Cast() function, the best you can do is to compare the structure of your view with and without data (i.e. the field lengths you get when you open it with NODATA and with data). The columns which return different lengths need to get padded in the view's select statement - for strings, padr(chfield, nn) as chfield; for numbers, nField+00000000.00 as nfield.

I have found the problem. The definition of my view was

create sql view vwcaixa as ;
SELECT Caixa.nrevento, Eventocx.dsevento, Caixa.dshistorico,;
Caixa.vlevento, Eventocx.idevento,;
IIF(Eventocx.idevento=1,"Entrada",IIF(Eventocx.idevento=2,"Saída","")) AS dsidevento,;
Caixa.dtevento, Caixa.nrmovto;
FROM ;
loja!eventocx ;
INNER JOIN loja!caixa ;
ON Eventocx.nrevento = Caixa.nrevento;
WHERE Caixa.dtevento = ( ?parmdtevento );
ORDER BY Caixa.dtevento, Caixa.nrmovto

The result of IIF must be the same size for all descriptions. In my case 7 bytes. So, the correct definition must be
SELECT Caixa.nrevento, Eventocx.dsevento, Caixa.dshistorico,;
Caixa.vlevento, Eventocx.idevento,;
IIF(Eventocx.idevento=1,"Entrada",IIF(Eventocx.idevento=2,"Saída "," ")) AS dsidevento,;
Caixa.dtevento, Caixa.nrmovto;
FROM ;
loja!eventocx ;
INNER JOIN loja!caixa ;
ON Eventocx.nrevento = Caixa.nrevento;
WHERE Caixa.dtevento = ( ?parmdtevento );
ORDER BY Caixa.dtevento, Caixa.nrmovto
Antonio Carlos Kleinübing
Systems Analyst
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform