Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
View definition has been changed
Message
From
13/11/2001 02:19:31
 
 
To
12/11/2001 11:28:46
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00580354
Message ID:
00580756
Views:
13
Hi!

I do not know - did not tried it that way (usually do preformatting in the SELECT - SQL statement).
BTW, you can open field properties dialogin the view designer, select required field and change its format for view cursor. Data will be auto-converted when queried to fit into the specified format, if possible.

>I want the field to be numeric 5. I've tried 0 as qty which doesn't work because the view designer says the field is "As qty" and drops the zero. I've tried:
>
>val(str(0,5)) which gives me numeric 4,2
>val(str(0,5,0)) giving N4,2
>val(str(0,1)) + 0000 giving N4,2
>
>I found that 00000 as qty gives me N3 in using the view designer but works in a sql statement so I tried 0000000 as qty in the view designer and got the sql statement as 00000 as qty and that works. Strange, eh?
>
>Thanks for your ideas and help! I guess I have to use the "7 zeroes to make 5"! Any ideas why? I think maybe the other 2 are used for decimal places that aren't there?
>
>Sally
>
>
>
>>Yes.
>>The field width should be always the same, as well as the field type. When you cannot determine field width from expression, do something like following:
>>
>>VAL(STR(MyField))+000000000000.00
>>
>>Above assure always the same format N(14,2)
>>
>>HTH.
>>
>>>Vlad,
>>>
>>>Thanks for the help. I'm about to try it. I know that views should maintain the same field widths but what about numeric field widths? What if the value of qty is 2 the first time the view is run and then 10 when it is requeried? Does this cause an error saying the view has changed?
>>>
>>>Thanks.
>>>
>>>>Hi!
>>>>
>>>>VAL(STR(0))
>>>>
>>>>Sometimes STR() can return "0" and sometimes "0.00". VAL() then produce different field types. This difference sometimes cause the error, because View field definition in database is different then the result of the view query. When you open database, database is updated automatically by a new structure of the view (that can cause conflicts in multi-user anvironment and should be *very* strongly avoided).
>>>>
>>>>Change it to the val(STR(0,2,0)), though I do not see reasons to use val(str()) - just specify "0 AS qty", unless VAL() return different result.
>>>>
>>>>HTH.
>>>>
>>>>>My form runs this view first and works every time:
>>>>>
>>>>>
>>>>>SELECT Btstorge.store_type, Btstorge.location, SPACE(8) AS co_id,;
>>>>> SPACE(5) AS info_type, CTOD("12/12/12") AS finan_dt, Btstorge.max,;
>>>>> Btstorge.nbr_boxes, Btstorge.user_id, Btstorge.added, Btstorge.modified;
>>>>> FROM bt!Storage Btstorge;
>>>>> WHERE Btstorge.store_type = "B";
>>>>> AND Btstorge.nbr_boxes = 0
>>>>>
>>>>>
>>>>>Immediately after, it runs this view and often gives me the error View definition has been changed, but not all the time:
>>>>>
>>>>>SELECT Btstorge.store_type, Btstorge.location, SPACE(5) AS info_type,;
>>>>> CTOD("12/12/12") AS finan_dt, Btstorge.nbr_boxes, Btstorge.max,;
>>>>> VAL(STR(0)) AS qty;
>>>>> FROM bt!Storage Btstorge;
>>>>> WHERE Btstorge.store_type = "S";
>>>>> AND Btstorge.max > Btstorge.nbr_boxes;
>>>>> ORDER BY Btstorge.location
>>>>>
>>>>>
>>>>>I found that if I put Open Database BT before the problem view, it works each time. Can anyone give me a clue as to what in the second view is different that would cause this issue and why the first one always works?
>>>>>
>>>>>Thanks!
>>>>>
>>>>>Sally
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform