Dynamic xpath value from association

0
I have two models with an association. A Meal model and a Reservation model to reserve a meal. When someone wants to make a Reservation I want them to filter down the objects for meals by selecting date and then a meal type (breakfast, lunch, etc). Currently I am using the Reservations_NewEdit page and I have a reference selector for Meal.date and Meal.type. When the user selects a date, I want to filter the options for Meal.type based on the selected Meal.date. I don’t know how to pass the Meal.date variable because it’s not a part of the Reservation model that encapsulates the Meal attributes. I’m trying to do something like this:
asked
2 answers
2

There are multiple solutions for your challenge. Depending on how the data is used in further steps of your app defines the best choice

 

Most simple solution

Single entity with the meal type as an enumeration, capturing the values Breakfast, Lunch & Diner.

If you want to show a list of reservations for a specific moment, i.e. lunch of today, then this is to simplistic.

 

A bit more sophisticated

The meal aka a specific moment captured in a entity with Date and type.

The reservation has a 1-* association so that you are able to select a single meal for the reservation

The page requires a reference selector to select a single meal. But the selection is done based on 2 values; the date and type.

Therefore a lookup/select page is the best suitable option out of the box.

A select page can be generated by right mouse click on the reference selector and select “Generate select page”

Showing a list of reservations per mail is now possible

 

More sophisticated fancy reporting

Introduction of a third entity, which captures the day. 

For this approach the user selects first the Day. Where after the user can select a meal out of the list meals of that day

To achieve this, The second selector needs to be constraint to the Meals for the selected day. This can be done using constrained by.

By selecting this option only the meals of the selected Day will be selectable.

This setup allows for reporting on the Date with a list of meals and reservations. And allows to have a more flexible setup of your meals. Though my guestimation is that this is shooting with a cannonball on a fly.

 

 

 

 

 

answered
0

Couple of things:

  • You have an input reference set selector, not a reference selector. Assuming one meal type to many reservations you could just use an actual reference selector
    • Doing this, you can’t use current object, it won’t be available but you could source it via microflow
  • Looks like you’re messing w/ date/times which can be tricky depending on how you set your dates. If/when you retrieve them you might not be able to use “=” in your xpath as times may not be equal
answered