Format Musk

navuser1navuser1 Member Posts: 1,329
Is there any property in Navision to Print a decimal Amount in
such format


If amount is 1000.000 than it print 1000.xxx
If amount is 1000.900 than it print 1000.9xx
If amount is 1000.009 than it print 1000.009
Now or Never

Comments

  • rajpatelbcarajpatelbca Member Posts: 178
    have u used property named "Decimal Places" of text box

    try it.......
    Experience Makes Man Perfect....
    Rajesh Patel
  • navuser1navuser1 Member Posts: 1,329
    I hv used Decimal Places but it does not replace 0s by X.
    Now or Never
  • XypherXypher Member Posts: 297
    Hey 'navuser1',

    I have a solution to your problem (although it is pretty rough).
    //StartNum    [Decimal]  assigned to Text001 textbox
    //Conversion  [Text]     assigned to Text002 textbox
    
    Mask := '%1';                                                         //Local Variable [Text]
    
    MiddleMan := STRSUBSTNO(Mask,StartNum);                               //Convert from Decimal to String and store in local var MiddleMan [Text]
    Conversion := '';                                                     //Can use a local variable to store the makings but I just assigned to global variable
    
    FOR Counter := 1 TO STRLEN(MiddleMan) DO BEGIN
      IF (MiddleMan[Counter] = '0') AND (FoundIt) THEN BEGIN
        Conversion := Conversion + 'X';
      END ELSE BEGIN
        Conversion := Conversion + STRSUBSTNO(Mask,MiddleMan[Counter]);
      END;
      IF MiddleMan[Counter] = '.' THEN FoundIT := TRUE;                   //Mark when we find the decimal point
    END;
    
  • XypherXypher Member Posts: 297
    Ah scratch that... that'll replace all 0's after the decimal point to 'X's.

    Well you can just adjust the code I have provided to come up with the solution you desire.
  • XypherXypher Member Posts: 297
    Ok ok ok, here is a much more refined code to do exactly what you want...
    MiddleMan := STRSUBSTNO('%1',StartNum);
    Counter := STRPOS(MiddleMan,'.');
    Counter := 3 - (STRLEN(MiddleMan) - Counter);  //3 is the # of places past the decimal point.
    
    FOR intCount := 1 TO Counter DO
      MiddleMan := MiddleMan + 'X';
    
    Conversion := MiddleMan;
    
Sign In or Register to comment.