Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, November 25, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Administration Forums - Database Administration
Forum to discuss SQL Server or Oracle database administration related to SalesLogix databases. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Database Administration | New ThreadView:  Search:  
 Author  Thread: Currency - What Data Type should it be in ADO
Lane
Posts: 121
 
Currency - What Data Type should it be in ADO Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Aug 07 11:52 AM
I am running NEW 7.0.1 Database and found that all the SLX Currency fields are of MSSQL Type Decimal (17,4) but all the Custom Currency Fields are Numeric 17,4.
Likewise the SLXProfiler reports the Numeric(17,4) Type as "DBTYPE is Unknown".

Has anyone seen this?
What SHOULD the types be and should I change them in the database and in my code?

Anyone seen this before?
[Reply][Quote]
Lloy Sanders
Posts: 69
 
Re: Currency - What Data Type should it be in ADO Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Aug 07 3:24 PM
We are running 7.0.1 on SQL Server 2005, and it looks to me like all of the standard fields are Numeric(17, 4). For custom fields I use Floats. Not sure if that is best practice or not, but it is the way I have been doing it for years, and have never had any issues. I would assume that either way would work.
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: Currency - What Data Type should it be in ADO Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Aug 07 6:11 AM
Fixed 17,4 is the best way to represent currency in SalesLogix.

At one time it was Fixed 15,2 and there were "precision" issues. Someone got the "bright" idea that going to float would solve that.. well.. it really makes it worse.

At the lowest level (processor instruction set) floating point arithmetic suffers from rounding errors. Example:
Do your product pricing in dollars/cents.. have a dozen or so items.. add them up in groups of 3 or 4 and than add that together.. now just all up all of them in one swoop... take each result and than diveide by the total number of items.. you will start to get "skewing"...

Computer Science 101 - floating point arithmetic is allways going to have rounding errors in either the "odd" or "even" side depending on how it was implemented. IBM had it right (in the mainframe days) - BCD arithmetic... no rounding errors.. no issues.

Fixed 17,4 gives us more precision and HELPS to reduce rounding errors.

You should change all of your custom currency fields to fixed 17,4 - we do.

--
rjl
[Reply][Quote]
Lane
Posts: 121
 
Re: Currency - What Data Type should it be in ADO Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Aug 07 8:43 AM
In the SLXProfiler are you seeing the Currency (Numeric 17,4) fields reported as [DBTYPE is Unknown] which is an indicator of a failure in sync, or are they reported as a defined type?

I'm actually writing followed be a select sum() and the select sum() comes back with zero all the time even though the valies are all there "Select Isnull(Sum(trans_Credit),0) from ... Where ...".

7.2 does it the same way SLX Currency fields are decimal (17,4), Custom fields are numeric (17,4).

When writing ADO Code to generate recordseets from code or move data around this becomes an issue with truncation and sync.
[Reply][Quote]
Lane
Posts: 121
 
Re: Currency - What Data Type should it be in ADO Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Aug 07 8:53 AM
Sorry RJ missed your post. I remember the bad old days of floats all too well, had to write salesorder is 3 crystal formats to avoid sumation totals after sync with Oracle, SQL & interbase.

Does Fixed 17,4 mean decimal 17,4 or numeric 17,4?
Is this oracle and sync compliant and provider compliant? Thats my real issue.

I'm writing an invoiceing batch the issuing updates to the participants of the batch resetting Amount Due/Paid/Remaining.
My write appears on the server side to write fine, but the Select IsNull(Sum(CurrenctField),0) brings back a zero.

If this works I'll di it, I just need to update a bunch of code and prefer doing in once.

Thanks
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: Currency - What Data Type should it be in ADO Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Aug 07 7:08 AM
Well. for SQL it's Numeric 17,4

BTW I always use the following to avoid NULL issues..
Select Sum(Coalesce(Price, 0)) as Costs from SomeTable

--

rjl
[Reply][Quote]
Lane
Posts: 121
 
Re: Currency - What Data Type should it be in ADO Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Aug 07 8:44 AM
Interesting, SLX just reported SDK is reporting it as a defect.
This might be only a SLXProfiler reporting error, or something else.
My sum() problem appears to make it more complicated.
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: Currency - What Data Type should it be in ADO Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Sep 07 8:25 AM
Hi Lane,
You mean Select Isnull(Sum.... has been reported as a defect?

--
rjl
[Reply][Quote]
Lane
Posts: 121
 
Re: Currency - What Data Type should it be in ADO Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Sep 07 6:58 PM
No, slx Profiler not being able to interpret a Numeric(17.4) update via code. They say it works fine through a bound form.
You get a [DBTYPE is Unknown] message.
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: Currency - What Data Type should it be in ADO Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Sep 07 6:45 AM
AH!...

--
rjl
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/25/2024 4:47:10 PM