« Openlog and Worst Practice? | Main| Be Careful with Blacklist Sites for Spam protection »

Computed for Display? Not Always...

Category Development

I don't know if it has always been like this or if something changed in the Notes Client, I'm using 8.0.2, but I had a pretty frustrating couple of hours working with Computed for Display (CFD) fields of all things.

I was pretty much minding my own business and adding some CFD's to do some calculations like difference and percent difference, and when I would look at the form with data in it, my expected results did NOT appear.  Ok, these were in a table and the cells must have been hidden right?  Wrong.  Nothing was hidden they just wouldn't display.  I added text around the fields and saw the text - but not the field.  I moved the field around on the form and that didn't fix it either.  I was pulling my hair out.  Then I tried renaming the field from "pct_ob_revenue" to pctOBrevenue and all of a sudden it displayed!?!  At first I thought that there might be an issue with the underscore.  I've seen Notes try and "drop" underscores before in view names and whatnot. But interestingly it wasn't the underscore in the field name.

The problem was that somehow there was an existing field in the saved backend document with the same name that I was trying to use.  The field existed but there was no value in the field.

It appears that if there's a field in the backend document with the same name as the computed for display field then the client will IGNORE the formula in the CFD field and simply display the value in the backend document. OUCH!  I don't know if that's a bug or not but I would think that could cause some problems if there's a way to get around formula calculation...

Anyway - I've never stumbled on this before so I wanted to pass this along.

Comments

Gravatar Image1 - It's always been there? Wow! I never bumped into it before.

I wasn't really converting existing computed fields... I created a bunch of new fields on a form and initially didn't set them all to CFD. Then as I was testing, the values got saved in my test document and the rest was history.

I can't believe this isn't a bigger issue... I would just think there could be some security issues what with the availability of the all purpose smart icon's that can change fields on the backend document... I'd think that the savvy user being able to "override" computed for display fields could have some fun... Who would even think to "validate" CFD fields in query save...

Oh well...

I've seen the Ytria stuff. Looks cool. I really want to get the ActionBar one to help me mass change the look over various form and view action bars.... I'm going to Lotusphere this year (first time) and hope they have a booth there to see all that they offer.

Thanks for the information!

Gravatar Image2 - @2 - Ytria will indeed have a booth at Lotusphere and I'll actually be hanging out there a fair bit seeing as how they are (surprise!) sponsoring me for the conference Emoticon

Gravatar Image3 - Yep, this has been around forever and usually results from a situation that goes something like this:

"Gee, these fields here are listed as computed but we really don't need to store these values in the backend and take up all the extra disk space. I'll just flip them to CFD and pat myself on the back."

Of course, this only gets noticed when the resulting value is something that's likely to change over time on a document that predated this stroke of genius.

So, for the record, if anyone reading this ever gets it in their head to try a stunt like this after an application has been used to create real production data, please finish the job by cleaning up the existing documents. A little cleanup agent like:

FIELD xyz := @Deletefield;
FIELD abc := @Deletefield;

will work, but I would highly recommend Ytria's ScanEZ tool { Link } because:

1) It will quickly highlight fields that exist on only some documents (use the "Diff" function), which is a red flag for fields that might have flipped to CFD at some point (especially helpful for cleaning up the "previous developer's" mistakes where no one remembers what fields were involved).

2) You can delete a given field out of an entire collection of documents quickly and without writing yet another throwaway agent.

3) et. al. [too tired to think of more reasons right now, but I'm sure there are more]

And since this already sounds like a commercial, I might as well mention that you can get a 10% discount (and yes earn me a small commission) on all Ytria tools using my coupon code: YTRIACOUPON_KEVINPETTITT

You will thank me...really.

Gravatar Image4 - CFD's are right next to default values when it comes to creating confusion. When you look at the doc, you see the default value even if the field doesn't exist.

By the way (Sales pitch warning) - Teamstudio Validator will find this and other issues in your database like broken doc links, orphan documents, rep/save conflicts, etc. end of sales pitch.

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Powered By:

Domino BlogSphere
Version 3.0.2