Convert zero value to spec. symbol

SolmyrSolmyr Member Posts: 51
Hi all!
I want to know, is it possible to convert decimal value wich is equal to zero to the specified symbol, for example '--', using FORMAT, CONVERTSTR or something else? I know that it can be easy achived by code, using text variable, but I'm trying to place it on the report control SourceExpr.
Thanks in advance.
Oleg Dovgalenko

Comments

  • krikikriki Member, Moderator Posts: 9,110
    Create a function that receives a decimal and returns a string.
    Use that function in the sourceexpression giving it the value.

    In the function, you put:
    IF IdecValue = 0 THEN
    EXIT('xx');

    EXIT(FORMAT(......));
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • SolmyrSolmyr Member Posts: 51
    kriki wrote:
    Create a function that receives a decimal and returns a string.
    Use that function in the sourceexpression giving it the value.

    In the function, you put:
    IF IdecValue = 0 THEN
    EXIT('xx');

    EXIT(FORMAT(......));

    Thanks, kriki!

    It's the more suitable way, because total amount of 'coded symbols' will be the smallest (considering that I have a lot of such controls on the report). I'll use this way. But I want to know, just to understanding, does NAV allow to provide this kind of replacement using standard functions? I played a little bit with format, convertstr, etc., but found nothing.
    Oleg Dovgalenko
  • krikikriki Member, Moderator Posts: 9,110
    Yes, it does. I have used a lot of times functions in the sourcecontrol-property to do some special formatting (both on forms and on reports).
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • SolmyrSolmyr Member Posts: 51
    kriki wrote:
    Yes, it does. I have used a lot of times functions in the sourcecontrol-property to do some special formatting (both on forms and on reports).

    I mean that in the sourcecontrol-property will not be the:
    FormatDecimal(ServiceJobTotalExVAT)
    
    where
    FormatDecimal(pDec : Decimal) : Text[30]
    IF pDec = 0 THEN
      EXIT('--')
    ELSE
      EXIT(FORMAT(pDec));
    
    but kind of:
    FORMAT(ServiceJobTotalExVAT,0,<some tricky parameters which do the same as user defined FormatDecimal fnc.>)
    

    if it's possible. but looking at the FORMAT help topic, it seems impossible.
    Oleg Dovgalenko
  • krikikriki Member, Moderator Posts: 9,110
    I misinterpreted what you asked.
    Indeed, the FORMAT does not support this kind of things. You need to create a function to format it.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.