Jump to content

List view show sub-summary part with no records


Recommended Posts

I'm building a meal tracking app (similar to MyFitnessPal).  The list view layout where the user views/edits the selected day's log has sub-summaries when sorted by meal name (breakfast, am snack, lunch, aft snack, dinner, etc), which appear above the body.  In most of the meal tracking apps I've seen, these headings show whether the meal has foods inserted into it or not, which is the behavior I want for my app.  Is there a way of achieving this in list view when the meal has no records (foods) in it?  I don't like the idea of using portals since they won't expand/shrink to fit the data, and other misc reasons.

Here's a screenshot of my app (left) and an example of what I'm looking for (right).

IMG_5639.JPG

I appreciate any help!

Link to post
Share on other sites

In this case you would need to use a virtual list to create a utility table that will have the

category even if it contains no meals. 

 

 

Link to post
Share on other sites

Thanks for the quick reply!  Most of the info I found in virtual lists was related to portals, and I couldn't quite get my head around it.  So I opted to just create a duplicate list view layout based off a table that just has 1 record for each meal name (8 records total), and a sort field.   When the user selects a date to log their meals, it checks for existing logs for the date/user id, and if none, it goes to the duplicate layout...otherwise it loads the records in the original layout.  Seems to be fast enough for my needs.

Link to post
Share on other sites

Here is an example of a virtual list..

you have a known set of categories, and the found set for a given date and collect the data into the virtual list and parse it out so that you can apply conditional logic to hide elements based on type.

 

Virtual.fmp12.zip

  • Like 1
Link to post
Share on other sites

That's perfect, thank you!  It makes a lot more sense now that I see it in a list view. 

Would you say a virtual list makes sense (particularly in terms of speed) even if I decide not to worry about showing meals that don't contain any foods?  The user will be adjusting portions of the foods, requiring filemaker to recalculate calories and macronutrients for the food, meal, and entire day.  It doesn't need to pull any data from related tables to do this UNLESS they change the unit (grams, ounces, cups, etc).  In that case, it would pull data from food_weight and food_nut_def tables to calculate the calories/macronutrients.  But from there the values would be stored in the parent table until a new unit is selected again.

Link to post
Share on other sites

With virtual lists you could logically build the globals with data already aggregated so that you don't have to do that work on the virtual list or necessarily compute values back thru relationships. 

 having a place holder for a category with out contents gives the user the inline ability to have a button where they can create that item - you can grab the date and the category and navigate to layout and create the record putting the variables into the record. Saves user a few steps. 

With 18 there is a new WHILE function that could be handy to compute this values. In addition you could even craft an SQL statement to build the data set needed to drive the virtual list.

 

 

 

  • Thanks 1
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

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