*** UPDATE *** Seems that Data Emphasis IS conditional. I updated the end of this article. Just scroll down… .
A big issue since the release of NAV 2009 is the 'lack' of colors. There was no possibility whatsoever regarding "coloring your fields on pages". Now, since NAV 2009 Service Pack 1, Microsoft introduces "Data Emphasis" as an enhancement. Let's try to find out what this is about and if it's really an enhancement (there is still no manual for this … so I'll have to do this on my own … (I'm just mentioning this to earn a little bit more credit … (… i'm going to shut up now … (…the word you're lookig for is … again … anywaaayyyy...)))).
I will take page 21 (Customer Card) and page 22 (Customer List) as pages to experiment with.
If we open the properties of the "No."-field of page 21, we notice these new properties :
The Style-property can have 5 values:
While the StyleExpr-property can contain either a variable (of the data type "boolean") or the strings "TRUE" or "FALSE".
Let's take it easy
Let's configure the "No."-field of Customer Card page like this:
If I run this page (remember that you can use the "run"-button in SP1), nothing really exciting is going on…
No colors, no emphasis whatsoever. Don't panic. Notice that you're in "view"-mode. Apparently, there is a difference for data emphasis in the different modes of a page. When you go in edit mode (you can do this by hitting CTRL+N (create new record) and scrolling down (by hitting CTRL+PgDn)) , you see that there IS a certain "emphasis", namely the value of the "No."-field is red:
That was simple, wasn't it?
Now, I tested with "Attention", but what with the other Option Values? Well, here's the list:
What about using these in a list?
When using these properties in a list, you'll notice there is no difference between view and edit mode. So, I just edited my list and changed the properties for the fields "No.", "Name", "Location Code", "Contact" with the result being a real "color-book":
Sorry dude, I only use conditional coloring. How do I do that?
Official statement of Microsoft: this is a no-go! (WHAT?? - Then there is no "bleeping" (remember the X-Files?) use for it, is there?). Now, hold your horses. I'm reading it as "this is not possible RIGHT NOW". Although .. What's that StyleExpr-property used for then?? Let me try to find out.
The property StyleExpr can hold a variable of the type "boolean". So let's just try to work with a variable and put it in the property. I created a variable blColorIt and set it TRUE when the "Location Code" of the customer was "YELLOW". Simple, isn't it. I put my code OnAfterGetRecord (seems most obvious for me)
blColorIt := ("Location Code" = 'YELLOW');
Unfortunately, it's indeed a no-go. All compiles well, but I get this error when running the page:
I've initialized my variable on every possible trigger I could find in my page, without succes. So, I'm guessing it's an internal issue … a feature that is not supported yet. If anyone succeeded in getting this to work … please don't hesitate to comment on this post … .
For me, coloring fields without conditions doesn't make much sense (may be for identifying mandatory fields … but that's it (imho)). But the fact that things are in place to make it conditional gives me hope that in the next release … it WILL be conditional after all.
Also keep in mind: I'm testing on a Technical Preview, not an official release … so the hope is still there that everything will be in place on the final release of NAV 2009 Service Pack 1 :-).
UPDATE!! (Thanks to wito)
No, it's not a no-go. You see, there is a new property on variable-level, namely "IncludeInDataset". If I set this to "yes" for the variable "blColorIt" and then test it again, you see this:
You clearly see that it works and is conditional. And you know now how to do it (as me … thanks, wito!).
I've put this into a new seperate blogpost so that the rss-subscribers got notified about the (rather quite important) turnaround of this post.
All of a sudden, the data emphasis on SP1 is very VERY useful for me. Coloring is possible, even conditional coloring. OK, only 4 types, but I can understand that Microsoft wants to "streamline" in some way. Let's use all the same emphasis for a corresponding status… .
Sure there is still a disadvantage. What if I want to color it Green OR red. Then, my friend, I think you do have a problem. Anyway ... let's embrace what we have now, and hope Microsoft keeps working on this.
The fact that I didn't know about this property makes me again very … let's say … MAD at Microsoft for still not having released NAV 2009 in Belgium. I'm sure that (and me being a little bit too lazy) is one of the reasons… .
Thanks for sharing with us!
Very helpful!! :)
Here is how the Transformation Tool sets Style and StyleExpr properties:
If FontBold is false and ForeColor is 255 (red), then Style is Attention and StyleExpr is true.
If FontBold is true and ForeColor is 255 (red), then Style is Unfavorable and StyleExpr is true.
If FontBold is true and ForeColor is 65280 (green), then Style is Favorable and StyleExpr is true.
Otherwise, Style is None and StyleExpr is false.
That's too bad ... .
May be for the next version, it would also be nice to have different colors on one field. Not just "color/no color", if you know what I mean ;-)
Unfortunately correct display of Style in ViewMode for the CardPage will not not make it to the SP. However I'm confident that it will make it to the next version as the cause and solution path has been identified.
Thanks for posting your comments, Henrik. Nice to see you're reading this too :-).
Thanks for demonstrating this feature :)
N.B.: The Style also applies in a factbox.
The Style (Data Emphasis) should actually work in ViewMode for a CardPage too (Example: No field on the Customer page).
I have logged a bug on this.