use BlankZero with another value<>0 in pages

kanika
Member Posts: 247
Hi experts!!
AV2018
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
AV2018
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
-1
Best Answer
-
Perhaps the HideValue property of a page field can help you do what you want.6
Answers
-
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 BEGIN IF InputValue = -9999.999 THEN EXIT(''); EXIT(FORMAT(InputValue); END;
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.OnAfterGetCurrRecord() BEGIN SomeGlobalTextVar := BlankMyNullValue("My Field"); END; The Field - On Validate() BEGIN EVALUATE("My Field", SomeGlobalTextVar); END;
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-030 -
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.
0 -
Perhaps the HideValue property of a page field can help you do what you want.6
-
that's HideValue
Thank you so much for everything0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions