Data migration

rhpnt
Member Posts: 688
Hi,
would anybody please be so kind and explain to me in plain english what the EVALUATE piece of code is all about?
It's a simple CASE sentence in a function for standard data migration when creating a new company (CDU8611-EvaluateValue(VAR FldRef : FieldRef;Value : Text[250]) ErrorText : Text[250]). The thing is in the XML file from where the data is retrieved the "Value" is e.g. 1.844,56, but after this evaluation the "Decimal" variable shows 1,85556!? Why is the evaluation written that way and not simply: EVALUATE(Decimal,Value)? Right now all item decimal values over a 1.000,00 (in the xml file) get a wrong (1,0000) value. The values in the xml file were exported from a different company in the same db.
I'm not a freshman in NAV but have to admit I don't have a clou with this one...
P.S.: NAV5 + SQL Server 2008 R2
would anybody please be so kind and explain to me in plain english what the EVALUATE piece of code is all about?
Field.Type::Decimal: BEGIN IF NOT EVALUATE(Decimal, CONVERTSTR(Value, '.', COPYSTR(FORMAT(1.1),2,1))) THEN EXIT(STRSUBSTNO(Text010,Value)); FldRef.VALUE := Decimal; END;
It's a simple CASE sentence in a function for standard data migration when creating a new company (CDU8611-EvaluateValue(VAR FldRef : FieldRef;Value : Text[250]) ErrorText : Text[250]). The thing is in the XML file from where the data is retrieved the "Value" is e.g. 1.844,56, but after this evaluation the "Decimal" variable shows 1,85556!? Why is the evaluation written that way and not simply: EVALUATE(Decimal,Value)? Right now all item decimal values over a 1.000,00 (in the xml file) get a wrong (1,0000) value. The values in the xml file were exported from a different company in the same db.
I'm not a freshman in NAV but have to admit I don't have a clou with this one...
P.S.: NAV5 + SQL Server 2008 R2
0
Answers
-
I know I am not an expert in xml stuff but 2 things of importance to me are :
a) Isn't the value 1.844,56 abnormal i.e. a comman after the decimal place? I have never seen that.
b) NAV 2009 have changed it (You must have seen that) to what you are sayingField.Type::Decimal: BEGIN IF NOT EVALUATE(Decimal, Value) THEN EXIT(STRSUBSTNO(Text010,Value)); FldRef.VALUE := Decimal; END;
CA Sandeep Singla
http://ssdynamics.co.in0 -
ssingla wrote:I know I am not an expert in xml stuff but 2 things of importance to me are :
a) Isn't the value 1.844,56 abnormal i.e. a comman after the decimal place? I have never seen that.
b) NAV 2009 have changed it (You must have seen that) to what you are sayingField.Type::Decimal: BEGIN IF NOT EVALUATE(Decimal, Value) THEN EXIT(STRSUBSTNO(Text010,Value)); FldRef.VALUE := Decimal; END;
It is the common way of numeric representation in Dutch Regions and few other places.
1.844,56 means 1,844.56--
Regards,
Raveendran.BS0 -
raveendran.s wrote:It is the common way of numeric representation in Dutch Regions and few other places.
1.844,56 means 1,844.56
Good to learn new thing :thumbsup: .
If this is true than Rhpnt it has to be a bug introduced and corrected by MS.CA Sandeep Singla
http://ssdynamics.co.in0 -
and the evaluate code comes from a topic here at mibuso.
to respond to your question.
The Evaluate function determines the local decimal seperator format(1.1) with 1 removed.
It then replaces the local decimal seperator in the value of the string being imported. so the evaluate will always be in NAV format. (decimal seperator ".")
However, since you import the thousand seperator also, your amounts over 1000 are incorrectly being evaluated because the thousand seperator matches the decimal seperator.
However, for export/import: readability in the file is NOT something that is required.
Get rid of those thousand seperators and let the code do its work.0 -
Sog wrote:However, for export/import: readability in the file is NOT something that is required.Get rid of those thousand seperators and let the code do its work.
Field.Type::Decimal: BEGIN IF NOT EVALUATE(Decimal, Value) AND NOT EVALUATE(Decimal, Value, XMLFormat) THEN EXIT(STRSUBSTNO(Text010,Value)); FldRef.VALUE := Decimal; END;
Thanks!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions