code syntax remove comma from decimal in RecRef

need to convert 11,375.75 to 11375.75 in Recref

can someone give me guidance.


  • serdarulutasserdarulutas Member Posts: 50
    I am not 100% sure but does it not depend on your OS regional settings by default?
  • AlexDenAlexDen Member Posts: 72
    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.
  • TryzubTryzub Member Posts: 2
    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.Amount := 11375.75;
    FldRef := RecRef.FIELD(17);
    testDecimal := FldRef.VALUE;

    // by default is formatted with <Integer Thousand> i.e. Format 0

    // comma or any other thousand separator is removed - Format 9

    More elaborated formatting could be achieved by composing the relevant FormatStr
  • TomSLTomSL Member Posts: 4
    my code is this.

    IF (TableID = 271) AND (BankMapRec."Field No." = 17) THEN
    IF EVALUATE(testDecimal,FORMAT(RecField)) THEN BEGIN

    But this is not going correctly. Still appear thosusand thousand separator. what should I do?
  • AlexDenAlexDen Member Posts: 72
    You have to format string during conversion to decimal:
    IF EVALUATE(testDecimal,FORMAT(RecField,0,9)) THEN BEGIN
  • TomSLTomSL Member Posts: 4

    Still appearing for thousand separator this too.
Sign In or Register to comment.