Yesterday, a client asked me to make a collapsible list in FileMaker. Essentially, he wants a subsummary list that only shows the “child” data upon request. In my head I initially thought “FileMaker can’t do that!” which turned into “there’s got to be some way” so I told him I would try.
I played around with a subsummary report to see if I could trick it into displaying what I wanted. The problem with the subsummary report is that the “child” data is in the body part definition. So once you omit all the child records, the parent goes away. I need a way to keep the parent record, and hide the children.
I was in the middle of compiling an email to my client telling him it’s not possible, and giving him a list of other work-arounds (popup windows, tooltip, ect) when it hit me: The only way to make this work is to have all the data in one table.
In this example list, I want to show dog breeds (parent), and then under each breed a list of all of its possible variations or mixes(children). So I made a shadow table that has foreign key to the breed table, a foreign key to the variation table, a sort field, and an action field.
Collapsible List TOs
My list layout is based on the shadow table, and all the fields on the layout are coming from either the breed or variation table. Therefore each record in the shadow table will have the _kf_Breed field populated or _kf_Variation field populated, but not both.
So here’s the kicker: when I press the disclosure triangle for the first time, I am actually importing the “child” variation records into the shadow table. When I press the disclosure triangle for the second time, I am deleting the “child” variation records from the shadow table. The sort field is to make sure that the children always sort with the parent. The action field is either “create” or “delete” and is toggled by the disclosure triangle script. The action field is only used in the parent shadow records.
Here’s how it looks:
List View – Parent Records
List View – Parent and Children Records
Collapsible List Screen Demo
Data Disclosure: The cost range for each dog mix is fictional. Although I really do think my yorkipoo is worth that much, if not more.
In a nutshell, here’s what the disclosure triangle script does:
- The catalog ID and the action are passed in as parameters, separated by a return character
- If action is empty because it’s the first time the parent’s arrow has been clicked, set it to “create”
- If the script parameter is empty, exit script
- Create a popup window to do the work
- If action is “create”, go to the Variation layout, find on the foreign key breed ID, import the Variation primary keys into the Shadow table
- If action is “delete”, go to the shadow table, find on the shadow records to delete, and delete them
- Update the original shadow parent record to toggle between “create” and “delete”
- Close the popup
- Select the original window
- Show all records
- Sort Records by the SortOrder field
Other tips to note:
- Use a clear button object (with no script attached) and add conditional formatting to the children rows
- Put the “go to detail” button behind the button object so it’s hidden for the child records
- The disclosure triangle itself is a calculation in the shadow table of type container
A few Cons:
- If you have a lot of children in your list, your importing may have performance issues, especially over the WAN
- You will have to refresh the parent list. I added a “refresh list” button to update the “parent” records, and I also update the list in my navigation script. If you have a lot of parent records that need to be updated, you can also update them in a nightly server script
Overall, pretty slick, Aye? The link to download the sample file is below. I’d be happy to answer any questions via comments or email: mencarnacao@soliantconsulitng.com Thanks for reading! Makah Encarnacao
Download the Collapsible List Sample File – ZIP
Update – here is a copy of HOnza’s file:
When I talk about FileMaker, I like to say “Nothing is impossible” and then “There are always at least two different ways to do this.”
I also like challenges set by someone saying “this can’t be done in FileMaker” or “There is only one way to do this.”
So I immediately had to ask myself: “is this doable without having all the data in one table?”
I won’t be able to sleep until I find a positive answwr 😉
Thanks for such an inspiring article!
Hmmm, even better challenge: do it in the original subsummary report WITHOUT changing current found set.
Not saying it is doable, I just hate giving up 😉
Hey, now I can tell you: Yes, I WILL be able to sleep! 😀
You were able to do it in a subsummary report? I would love to see that!
Just finished the example: http://24usw.com/cssmr
It would need some more polish but at least shows the key idea 😉
HI I click your lin but it only goes to a webpage. How can I get a copy of your work? Hope I am not too late.
When I tried our link, it worked. But when I tried HOnza’s link it goes right to the home page.
Hi Vincent I updated the bottom of the blogpost to provide a link to HOnza’s file.
Wow brilliant! I didn’t think to use the header part. I like yours better than mine 🙂
Thanks. It still presents some other challenges, such as how to make the second subsummary part shrink or disappear completly instead of showing once, but even that can be done.
I really like what can be done with subsummaries by tweaking the sort order…
Be nice if all of this was structured as value list!! And value list that activated buttons.
If i click on my Parent results Finds all the Collapsible Subsummaries items.
However if i click on any child my results Finds just that Child data.
FROM:
Natures Sanctuaries
Rob J Lewis
alias:   jesus Land Tidd
(|||||||()|||||||()|||||||()|||||||()|||||||()|||||||()|||||||)
  
┬á┬ámoments of silence — earths┬á
┬ádynamic airwave — changes all
  
(|||||||()|||||||()|||||||()|||||||()|||||||()|||||||()|||||||)
Wow, impressing and inspiring (both examples!)
In the first example I am mostly impressed by the speed of the import and the whole process!
The second example I just understand better 🙂 And I do like working on real data instead of putting everything in a shadow table.
Going to use it in a project right away…
Thanks Andries! I am definitely going to update my solution to use HOnza’s method. You are right, it is cleaner. I’m glad to hear you are implementing this concept in your solution!
Thanks for the post, I needed to implement a collapsible list in FileMaker, this works great.
I have only been working with FileMaker for about 6 months and was wondering if you could explain the purpose of the base_TO tables?
Hey , i read this months ago and didn’t know what to do with it. Now i understand and appreciate the Honza “Simplification!”
this is a start and thanks for sharing.
_ian
In the example file the arrow isn’t shown on the imported records, but you can still click in that area. If the hidden arrow is clicked it imports the child records for all Breed Name records and you have to double click the real arrow for all records to delete the imported records. Is there a way to disable the button/script in the imported records?
If you are in a hurry, which we usually are, you could give an impression of colapsable list by just switching between two layouts.
The first layout is the list with the subsummaries and records.
The colapsed view is is an exact dupliate of the same layout except that you set the height of the body to zero px or close. Also set the field height to 1 px. The list will only show the subsummaries since the body part is too small to show the fields.
Did anyone figure out a way to make the subsummary shrink or disappear? I like this method, but blank space is a bit cumbersome.
“HOnza, August 18th, 2011 4:58 pm
Thanks. It still presents some other challenges, such as how to make the second subsummary part shrink or disappear completly instead of showing once, but even that can be done.
I really like what can be done with subsummaries by tweaking the sort order…”
Very nice!!
Probably an obvious question by newbie, but I cant figure something out. How does the sortOrder field get populated? Seems to equal kf Breed.
Thanks
Steve
Hi Steve! Apologies for the late reply. The sortOrder field is the kf_Breed and is populated in the import script step in the script “BreedList_ShowSubList (breedID ┬╢ action)”. Good luck!
Hi nice post! I am new to FMP and how can you display the “imported data”? are you using portal to display? also, which step can let you import the record 1 row below the parent? Please advise
Hello! I am using a list view to display the data. The imported data lives in the shadow table, just like the parent info. If you’d like to have the children listed in a specific order, I recommend you add a sort field to the tables. FileMaker can sort by multiple values, so your first sort would be the sortOrder field, and then the second sort would be the one you created. Hope that helps, good luck!
hello, thanks for your reply. I tried to follow your code and I have a trouble to make the child list. When I import child records, it is ok but it just copy the port row format and in your code, it will mask the button with a yellow color bar. How can I mask the arrow button and only shows the child records as yours? Sorry to cause any trouble from me.
I was able to do it very well…thank you very much
Can someone explain to me how Honza’s solution works? What is it that determines whether or not a sub-summary bar appears?
Never mind…
Very cool stuff. I modeled a collapsing list after HOnza’s. I tried just hiding the fields in the collapsed list (second sub-summary) if the triangle is the collapsed triangle, but the triangle is always in the first unsorted item, even if I sort the relationship. So when sorted the way I want them when expanded, the first record is not the one with the triangle, therefore the triangle in the summary is blank. Is that why HOnza had the blank relation to the collapsed relationship, to cover the field rather than hide it?
Hi Scott, I am not sure I follow your setup. There are no hide conditions in his demo, and in order for the sub-summaries to work, the records need to be sorted via a script (not the relationship). I will reach out to you directly to see if I can help you troubleshoot.
Hello all,
I see this is a very old thread but has lasted over years so I will go ahead and try to ask a question or two.
I downloaded Honza’s solution and the file opens to the CollapsibleSubsummaries layout but there does not appear to be any data in it. I click around to find a field but find none. I’ve tried starting a new record but no fields appear. I can see the Manage Fields list and relationship tables and can see scripts. I can make out much of what is going on but without data in the main layout it’s difficult to see how the solution is working.
Specifically I’d like to understand if the solution indeed opens the details for only one summary while maintaining the rest of the summary list. In my own solutiong I can get as far as opening and closing all details for the entire list but would like to refine the solution to opening the details for the specifically selected summary line(s). As my downloaded example file seems to have no data, nor anyway to put in data (maybe I can make up a spreadsheet and import new data?), I can’t see the file in action.
Thanks
OK, so nevermind,
I realized when the sample file opens it hadn’t been sorted for the summaries to display. I sorted the summaries and the data displays now. And yes, the solution opens individually selected summary data. I continue my study………