use BlankZero with another value<>0 in pages

kanikakanika Member Posts: 247
Hi experts!!

I need that in a field if it has value -9999.999 automatically put blank because this is my null value.

In table this value is like InitValue, I thought I would take it as 0 and with the property blankzero = yes it would be solved but it does not take it as zero and it appears

In NAV2009 I had a function (in the form onformat) for this but in Nav2018 I need help please

Best Answer


  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2018-08-07
    BlankZero property does exactly what it says on the tin = blanks zeros, and zeros only

    If numbers allowed in your field are non-negative (0 or bigger) you could use BlankNumbers property and set it to BlankNeg

    If the field is supposed to display all negative, zero, and positive numbers, and only this one specific value -9999.999 is supposed to be hidden then you need to write a bit of the code to manage it - a function or two - depending if the field is supposed to be editable or not.

    If the field is non-editable then you would only need one function, like this:
    BlankMyNullValue(InputValue : Decimal) : Text
      IF InputValue = -9999.999 THEN
    You could use this function directly in SourceExpr property:
    SourceExpr:= BlankMyNullValue("My Field");

    If however you need to keep the field editable then you would need to created global text var on the page, assign the var to the SourceExpr property, in OnAfterGetCurrRecord trigger set the value of the field using SomeGlobalTextVar := BlankMyNullValue("my field"), and in OnValidate you would need another line of code to interpret what user typed in the field and assign it back to your field.
      SomeGlobalTextVar := BlankMyNullValue("My Field");
    The Field - On Validate()
      EVALUATE("My Field", SomeGlobalTextVar); 

    The drawback is that once you start using code to manage displayed values you will lose the possibility of sorting along that field.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • kanikakanika Member Posts: 247
    edited 2018-08-08
    Hi Slawek_Guzek, thank you for your reply, It's not what I need :(
    the initial value of the field in the table is -9999.9999, when a record is inserted this is the default value, the field is editable, and in some cases another value (decimal) will be set and in some cases it will not. (same as blankzero when the Initvalue = 0)
    What I need is that when the field has the default value it appears blank, without having to go through the field but it is editable for when the value has to be changed.
    Your second example it is not valid because it does not respect the decimals; they are calculation data for a laboratory and the decimals must be very precise

    Anyway, I need the data -9999.9999 not to appear without having to go through the field.
  • kanikakanika Member Posts: 247
    that's HideValue
    Thank you so much for everything
Sign In or Register to comment.