Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Floating point and remote views
Message
From
21/07/2011 11:14:36
 
 
To
21/07/2011 11:08:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01518756
Message ID:
01518785
Views:
46
I'll give it another shot. I tried the B(16) in the DBSetprop as you showed below but in my DBCX it still show B with a length of 8 ( whatever that means ) and Binary = .f.

They just used float for everything, including fields that would go into the millions but with only 2 or 3 decimals and other fields with values that would never be more than 1 but could go 10 decimals.)

What would be the proper data types in SQL to do the cast on the sql select in the remote view for those two cases so they would make sense to VFP?

i.e. I don't need to treat them the same as there are definitely 2 categories of numbers that are using float, and each is limiited on each side of the decimal.


>N is not a good field type here (- .9999999999E+19 to .9999999999E+20)
>
>cast(0 as float) gives N(10,0)
>cast(0 as B) gives B(2)
>cast(0 as B(16)) gives B(16)
>
>I think B(16) is your best bet
>
>You can change the field type of your remote view - if memory serves
>
>
>
>DBSETPROP('Viewname.fieldname, 'field',  'DataType', 'B(16)')
>
>
>
>
>>>Charles,
>>>
>>>Can you cast as B(16) ?
>>
>>That seems to get the same result as casting as B
>>
>>VFP help says float is included for compatibility but is functionally equivalent to numeric. I'm wondering if there is a way to convert these things to very large numerics N(32,10) or something.
>>
>>(addendum - casting as n(32,10) for the view is not an option)
>>
>>>
>>>>I am hoping some of the serious math wonks will take pity on an old man who still finds long division challenging.
>>>>
>>>>I have SQL database tables that make heavy use of floating point numbers.
>>>>
>>>>In my remote view, I am pulling half a dozen of those numbers. The remote view defines them as data type 'B' ( of which I have not previous experience)
>>>>
>>>>I need to multiply those number together, then put the result in a field I created as part of the remote view ( casting a 0 as float )
>>>>
>>>>But in the watch window these values all show up as N , even though the values can look like 140333030.002033021000
>>>>And when I multiply them the result looks like a float, But when I try to save the value into a view column, I get a numeric data overflow.
>>>>
>>>>Trying to cast the numbers as B just gets them lopped off after about 4 decimals. ( I think this has something to do with 16bit vs 32 bit math, but since my brain runs on an i386sx chip, it is beyond me )
>>>>
>>>>I'm sure this problem is nothing new to anyone who has tried it and I found this
>>>>
>>>>http://fox.wikis.com/wc.dll?Wiki~VFPFloatingPointDataType
>>>>
>>>>on the wiki.
>>>>
>>>>But I am trying to wrap my brain around how to employ conversions ( and which of the functions to use ) in pulling, manipulating and hopefully saving the data.
>>>>
>>>>Really stuck on this one.
>>>>
>>>>TIA


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform