Jump to content
Server Maintenance This Week. ×

Conditional Value List with Self-Clearing Fields


This topic is 4521 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I've always loved conditional value lists, but I've been bothered that it's easy for data errors to be made:

1) select an entry from the first menu

2) select an option form the second menu (that's related to the first)

3) change the first menu's entry

This will leave the record with an entry in the second menu that is not related to the first menu.

There are ways to avoid this, but (until now) all have required modal interface designs or event plugins to run scripts after fields have been entered, or both.

No more.

This technique uses the auto-enter calculation feature of FMP 7+ and combines it with the Evaluate() function. Evaluate has the option of trigger fields.

When the first field is changed, the auto-enter in the *second* field is triggered. It checks whether the field value is in the value list and clears the field if it is not.

No scripts, no plugins.

I'm just designing a solution that has 3 conditional value lists, and this technique ensures that data can be correctly entered and accommodate later edits without the need for scripts or plug-ins.

All the magic happens with the auto-enter calculation on the Media ID field in the Clear Fields table.

Share and Enjoy.

Clear_Fields.fp7.zip

Link to comment
Share on other sites

D'Oh!

So just referencing the first field in the Let() statement causes it to be a trigger field? (even though nothing is done with it!)

I like it... the Evaluate() function meant that the calc had to be in literal text, requiring all the quote characters to be escaped (if that's the right word).

I was expecting "my" method to be improved upon by others on the Forum... :yay:

Link to comment
Share on other sites

A reference is reference. The optional triggering mechanism of Evaluate() should not be used for its own sake - it's there BECAUSE the expression parameter must be literal text, therefore it is not referencing the required fields.

Link to comment
Share on other sites

  • 1 year later...

Hello Vaughan,

Your "clear fields" solution solves a problem I have been wrestling with, so thank you for contributing it! However, I am dealing with 3-level hierarchies (e.g., category > type > subtype). I have been having difficulty adding a 3rd level to your solution.

Do you happen to have a version of it set up for 3 levels that you wouldn't mind sharing..?

Many thanks..

Carlos

Link to comment
Share on other sites

Thanks. I had already looked at that some months back and it didn't fully address the problem. Can't remember why (and I'm no longer subscribed so I can't view it again).

I think I almost have it though. Just working through one last snag.

I appreciate the reply...

Link to comment
Share on other sites

comment:

I feel bad that I had not realized you had already suggested a solution some months back when I first started wrestling with this. Sorry! I had to put the project aside and now I'm on it again, and I've been looking at the solution you shared then ("condVL2+clear2").

As I mentioned, my solution requires 3-level value lists, and I've been having difficulty modifying your solution to add the 3rd level. I was hoping you would be kind enough to take a look at what I've done (attached). I've been at it for hours with no success, but I'm sure you'll spot the problem in a minute. I'd be MOST grateful.

Notice the problem when selecting the "subtype" (3rd level) in the table layout: it shows all the subtypes associated with the top level ("category"), instead of only the ones associated with the combination of "category" and "type" (my 2nd level). Not sure if the snag is in the relationship or in the auto-calc field. You need to look at the "retail" category to see what I mean.

Also, when "retail" is selected (but NOT when other category values are selected), the subtype field is cleared as soon as I select a subtype value. Can't figure out why that is happening!

I feel this is THE solution if I could just get past these two snags...

THANKS AGAIN!!....

Carlos

condVL2_clear2_REVISED.fp7.zip

Link to comment
Share on other sites

comment,

I stumbled upon the solution, and thought I would post it here, in case anyone else has the same difficulty I had. I believe I had the wrong syntax in the auto-calc field for the 3rd level: it was pointing to the wrong TO. Now your "condVL2+clear2" solution seems to work exactly the way I need it to, so if you don't mind, I will borrow it for my properties project. Initially, I will use it to allow users to select the appropriate zoning district, based on the governing municipality, which is selected from a list based on the county selected. Also for property categories, types and subtypes (a few of which are shown in the attached).

Many thanks for sharing your solution!!

Cheers,

Carlos

condVL2_clear2_REVISED.fp7.zip

Link to comment
Share on other sites

Hey Vaughan,

This is very well done and thought out. It’s straight forward and incredibly useful. I know you said you were designing a solution that led you in this direction. But what made you decide on this specific method. Trial and error or just walked right into it?

I know how you can get great inspiration from, ah shall we say Sheila! :)

Good work Vaughn,

Harry

Link to comment
Share on other sites

  • 10 months later...

Thanks a lot for this great file...

I played with it and added a Tertiary Value. (Similar to CDiez' solution, as I've just realized...)

There is only one problem that I cannot solve: I cannot get cleared the third field properly if there are two Primary Values that use a Secondary Value with the same name. To make it clearer, I added MOUNTAIN RANGES both under AMERICA and EUROPE. If I for example choose EUROPE - MOUNTAIN RANGES - Alps and then click on AMERICA I still see Alps in the third field. The attached file hopefully helps making clearer what I mean.

(Background info: Though in this case the example seems a little odd, there is a real situation behind it: The library system I work with has different SECTIONS (= Primary Values), CATEGORIES (=Secondary Values) and SUBCATEGORIES (=Tertiary Values). Every section (e.g. Arts, Politics, Geography) has a Category named General.)

Any ideas?

B) Mike

condVL2_clear2_THIRD_VALUE.fp7.zip

Link to comment
Share on other sites

  • 1 year later...
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.