Your Development & Design Resource
Suggested approach to Hide-When formulas
09/21/2005 12:35 PM by Chris Toohey
My hide-when game had seen some better days... I kept getting the logic backwards. I would hide something that I wanted to show or show something when I wanted it hidden or, when I finally thought I had gotten the formula juuuuuuust right, it would never show. I found that I was thinking about this all wrong... I just didn't get how hide-when formulas worked. I know, it's pretty darned basic, but it's something that failed to sink in. I have a pretty good grasp on them now, and found a pretty foolproof way of getting them to perform exactly how you want them to.
First, I'll show you how I understand hide-when's to work...
In formula, for example:
@If( val; hide; show)
The above formula example checks for the logical value in the val (for example, 1 or 0) and, if true, the element is hidden - otherwise it's shown. Pretty simple and basic - agreed. The problem that I always had was the logic behind the hide-when, as presented in the properties box...
if val is true than hide this; else show this... now define
Not that this is a big deal, but when you're dealing with a very complicated hide-when formula based on field values, client types, access levels and the like, it can be very confusing when all of the other languages that you're dealing with don't have this type of flow.
Thus, I started using the following approach to deal with hide-when
formulas: A nested
@If( "I_want_to_show" ; @True ;
field1 = "" | field2 != "", I use
@If(field1 = ""; @True; field2 != ""; @True;
@False). This pretty much keeps me in line with the flow of
formula. Keeping in mind that @True hides and @False shows a given
element, I find it much easier to get through a more complex formula.