AutoFormatExpr

ProntiolProntiol Member Posts: 10
edited 2006-08-16 in Navision Attain
Hi there!

What defines autoformat rules when no currency is entered in the field, which is used as AutoformatExpr? Help says then LCY is used, when Currency is empty, but how do i change formatting rules for LCY?

Thanks in advance

Comments

  • kinekine Member Posts: 12,562
    How to find the answer:

    Pres F1. There is written:
    When you use the AutoFormatType and AutoFormatExpr properties to format a field, a trigger called AutoFormatTranslate in CodeUnit 1 is called. AutoFormatTranslate has ID 12 and takes two parameters; one from the AutoFormatType property and one from the AutoFormatExpr property. The AutoFormatType property contains an integer (0, 1 or 2) and the AutoFormatExpr property contains text (“ =LCY”).
    If you have appropriate license, open the CU 1, find the function AutoFormatTranslate. There is this code:
    ...
    CASE AutoFormatType OF
      1: // Amount
        IF AutoFormatExpr = '' THEN
          EXIT(STRSUBSTNO(Text012,GLSetup."Amount Decimal Places"))
        ELSE BEGIN
          IF Currency.GET(AutoFormatExpr) AND (Currency."Amount Decimal Places" <> '') THEN
            EXIT(STRSUBSTNO(Text012,Currency."Amount Decimal Places"))
          ELSE
            EXIT(STRSUBSTNO(Text012,GLSetup."Amount Decimal Places"));
        END;
    
      2: // Unit Amount
        IF AutoFormatExpr = '' THEN
          EXIT(STRSUBSTNO(Text012,GLSetup."Unit-Amount Decimal Places"))
        ELSE BEGIN
          IF Currency.GET(AutoFormatExpr) AND (Currency."Unit-Amount Decimal Places" <> '') THEN
            EXIT(STRSUBSTNO(Text012,Currency."Unit-Amount Decimal Places"))
          ELSE
            EXIT(STRSUBSTNO(Text012,GLSetup."Unit-Amount Decimal Places"));
        END;
      10: EXIT('<Custom,' + AutoFormatExpr + '>');
    END;
    

    Are you able to see, which table and which field is used when AutoFormatExpr is empty? :whistle:

    As you can see, it is easy to find the answer, do not be afraid to try it. :-)

    If you have no enough rights to open the CU1, answer is: G/L Setup is used.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ProntiolProntiol Member Posts: 10
    Thanks, kine! Your answer is correct, but my question probably wasn't clear enough.
    I have configured default rounding in "General Ledger Setup" table, but I was just unable to enter more than 5 decimal places.
    Navision says in a message box: "Field can not have more than 5 decimal places" and that's all. It looks like there is "DecimalPlaces" property is set to "2:5" in this field, but it has "<default>" value.

    There is a "Decimal Places" configuration for every currency in the "Currency" table, and it works well, when "Currency code" field is not empty. But when it is empty, it uses some default configuration (LCY currency) but where can I set up this default one?
  • kinekine Member Posts: 12,562
    As I wrote: in cases of local currency the G/L setup table is used. Mainly the fields:

    Amount Decimal Places
    Unit-Amount Decimal Places
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ProntiolProntiol Member Posts: 10
    Oh, my fault.
    Setting "Unit-Amount Decimal Places" to "2:6" in "General Ledger Setup" solved the problem.
    Thank you, kine.
  • kinekine Member Posts: 12,562
    You are welcome...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.