Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
View Definition problem
Message
De
09/01/2013 11:46:53
 
 
À
09/01/2013 11:38:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01561890
Message ID:
01561911
Vues:
64
J'aime (1)
>>>>>In an app that has been working happily for many months I am suddenly getting Error 1494 - View definition has changed.
>>>>>
>>>>>I can open the view in the database and browse it by providing the required input parameter. I have tried deleting the view and recreating it.
>>>>>
>>>>>It is a very simple view taking only 3 fields and generating 1 cacluated field from a single table.
>>>>>
>>>>>I am at a loss to see why it will suddenly not work in the app when it works when I access it directly in the dbc.
>>>>>
>>>>>Any ideas?
>>>>>
>>>>>Barry Sutton
>>>>
>>>>
>>>>It may be that the properties of your calculated field change depending on the parameter.
>>>>
>>>>What is the definition of the view - and what is the structure of the table it is built on ?
>>>
>>>The sql part of the view is:
>>>
>>>
>>>SELECT Plugtrays.id, Plugtrays.pretype, Plugtrays.week,;
>>>  Plugtrays.positions*Plugtrays.nosown*Plugtrays.prcnt/100 AS seedlings;
>>> FROM ;
>>>     production!plugtrays;
>>> WHERE  Plugtrays.detl_idno = ( ?v_plandetls.detl_idno );
>>> ORDER BY Plugtrays.id
>>>
>>>
>>>Plugtrays.id = C5
>>>Plugtrays.pretype = C15
>>>Plugtrays.week = C2
>>>Plugtrays.positions = N4
>>>Plugtrays.nosown = N5
>>>Plugtrays.prcnt = N3
>>>
>>>v_plandetls.detl_idno is provided by the app at run time ; both v_plandetls.detl_idno and Plugtrays.detl_idno are C6.
>>>
>>>I have rebuilt the view with a completely different name in the dbc and still get the error in the app but not when browsing the view directly.
>>>
>>>I am beginning to think that the Error message is spurious and in fact there is something else going on....
>>>
>>>Barry
>>
>>Try
>>You may want to change B(15) depending on the number of decimals you need
>>
>>
>>>
>>SELECT Plugtrays.id, Plugtrays.pretype, Plugtrays.week,;
>> cast( Plugtrays.positions*Plugtrays.nosown*Plugtrays.prcnt/100 as B(15) ) AS seedlings;
>> FROM ;
>>     production!plugtrays;
>> WHERE  Plugtrays.detl_idno = ( ?v_plandetls.detl_idno );
>> ORDER BY Plugtrays.id
>>>
>
>
>Gregory
>That worked! Thanks.
>
>But, could you explain why? I can't understand why the CAST function should make a difference.
>
>(It doesn't look like a case of View Definition Changed to me)
>
>Barry

Well, I suspect the number of significant fractional digits returned from the division depend on the input, or on the data in the parameterized query
Sometimes it will return a N(20, 2), other times N(20,3) - (this is an example)

When you create the view, it will define the field as eg N(20,2). The in run time, with other data, it returns eg N(20,3) which is different from its definition save in the database

So, by casting you force the calculated field's definition to be the same independent of the input
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform