Nested Subcategories


#1

I have a database that tracks transactions from a number of accounts. Transactions are assigned to categories and subcategories. Due to the types and number of transactions the list of subcategory values is pretty lengthy. Is there a way to limit and display subcategory values based on the category value selected? In Filemaker I would do this by pointing the fields to a list that maintained the structure of possible values.

Thanks


#2

It depends somewhat on how you want to handle that list of subcategories but ArrayBuild is likely to work for you.

With the selected category placed in a variable it would be something like this:

Let vCat = Category
Let vSubs = “”
ArrayBuild vSubs,¶,"",?(Category=vCat,SubCategory,"")

In the above, the contents of a field named Category of the active record is being loaded to a variable named vCat. An empty variable of vSubs is created. Then an array (list) is built in vSubs of all values in a field named SubCategory that have the Category that has been loaded into vCat.

At that point you may have a lot of repeated SubCategory names. ArrayDeduplicate would eliminate those.

ArrayDeduplicate vSubs, vSubs,¶