code syntax remove comma from decimal in RecRef

TomSL
Member Posts: 4
need to convert 11,375.75 to 11375.75 in Recref
can someone give me guidance.
can someone give me guidance.
0
Answers
-
I am not 100% sure but does it not depend on your OS regional settings by default?
https://resrequest.helpspot.com/index.php?pg=kb.page&id=2791 -
Hi,
EVALUATE(DecimalValue, DELCHR('11,375.75','=',','),9); FieldRef.Value := DecimalValue;
But be aware that for 11375,75 this code returns 1137575 as a result.
For 11 375,75 a conversion error will occur.1 -
Decimal C/AL type variable/field can be easily formatted without thousand separator which depend on the OS Regional Settings.
I would use the Format function with XML settings (last parameter is 9).
String := FORMAT(Value [, Length] [, FormatStr/FormatNumber])
// Sample
T17_Temp.INIT;
T17_Temp.Amount := 11375.75;
RecRef.GETTABLE(T17_Temp);
FldRef := RecRef.FIELD(17);
testDecimal := FldRef.VALUE;
// by default is formatted with <Integer Thousand> i.e. Format 0
MESSAGE(FORMAT(testDecimal));
// comma or any other thousand separator is removed - Format 9
MESSAGE(FORMAT(testDecimal,0,9));
More elaborated formatting could be achieved by composing the relevant FormatStr1 -
my code is this.
IF (TableID = 271) AND (BankMapRec."Field No." = 17) THEN
IF EVALUATE(testDecimal,FORMAT(RecField)) THEN BEGIN
RecField.VALUE(FORMAT(ABS(testDecimal),0,9));
But this is not going correctly. Still appear thosusand thousand separator. what should I do?
0 -
You have to format string during conversion to decimal:
IF EVALUATE(testDecimal,FORMAT(RecField,0,9)) THEN BEGIN RecField.VALUE(FORMAT(ABS(testDecimal),0,9));
0 -
Alex,
Still appearing for thousand separator this too.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