Monday, February 7, 2011

On the Fly Semi-Dynamic Value List (Demo File)

Why I created this DEMO?

We have a lot of ways to do value lists, YET I was experimenting with another way. I was feeling lazy about building a TABLE to store yet another small set of values and I didn't really want to do it with a typical hard coded value list . I guess I'd say this is a semi-dynamic / semi-hardcoded value list method. It still requires telling the solution what the values are (as you would via the indexed field method and adding records or also by hard coding them in the standard FM create Value Lists feature). This is somewhere in between cause you can script the values and obviously anything you can script is pretty dynamic. With this method you do use the indexed field option to create your Value List/s, but it doesn't involve multiple tables. This is a hack. I'm really not sure if this will play well in real world situations. I haven't had the opportunity to use this yet. That's kind of why I'm doing the demo, to see how it works and have a reference for when I might want to pull this technique out of the bag. AND maybe you will do something really cool with it that I would never think of and come back and tell me about it. :)

What's going on with this DEMO?

Getting to know this demo file will show you how to create a value list, based on a field index of a single record.  Again, maybe this is typical and everyone's doing it already but I haven't seen it out there, so here it goes, even if only for my own experimentation. :)

What are the moving parts in this demo?

1 - Table (Settings) with one record and some value list fields.
1 - Table (Contacts) just some data to have fields with value lists on.
1 - Script ON OPEN it sets it all up.
1 - Script that loads the value lists ... "Load value lists".
1 - Layout to display our records and value lists (Contact List).
1 - Layout for the interface (in this case it's this About This demo layout).
2 - Fields in interface table for each value list. To extend this you would need fields for each value list, instead of entire tables for each value list.
2 - Value Lists based on the above two fields in this demo "BusinessType" and "FavoriteThings".

Why is this cool?

I think this is cool cause you can dynamically SET a value list with scripting to be what you want. YES, it involves maintenance of those scripts but it also allows you to skip having a table if you don't really need it and with some planning you could set up lists fairly dynamically. Depending on what you're trying to do. This is definitely not the "right" normalized way of doing things but there's always a time and place for a short cut and perhaps this is a useful one.

How to get started with this file?

Click on the link (upper right) "Contact List", notice the value lists that appear under "Business Type" and "Favorite Things". Looks at those in the Manage --> Value Lists under File menu. Review the Load Value List script and check out the tables and fields. It should all start to click from there. This demo assumes you know a bit about FileMaker development otherwise it might be a little confusing sorry...

Demo_OnTheFlyValueList.fp7


Thanks for checking out this demo!