Syntax to show values.

johnnyc313johnnyc313 Member Posts: 93
Hi, there was a problem when importing a list of Items. Some got imported with a some values with 3 digits after the decimal place.

I am looking for the syntax for my report to show only values with 3 digits after the decimal place.

Is this possible?

Comments

  • KowaKowa Member Posts: 925
    Split the value into an integer and a decimal part, format the decimal part into a text and count the length.

    Example :
    a := 34.567 DIV 1; // in the report, use the real values instead of 34.567
    b := 34.567 MOD 1;

    will return :
    a = 34
    b = 0.567

    The DIV line is only for demonstration, you only need the MOD function.

    In this example
    IF STRLEN(FORMAT(b)) < 5 then
    currreport.skip;

    would skip the record,
    so in the OnAfterGetRecord write :
    IF STRLEN(FORMAT(MyValue MOD 1)) < 5 then
    currreport.skip;
    Kai Kowalewski
  • kinekine Member Posts: 12,562
      b := 34.567 MOD 1;
      if (b>=0.001) and (b<=0.999) then
        CurrReport.SKIP;
    

    You can modify the condition based on your needs
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.