Field that corresponds to another field that is a list

  • I have a data set of “Dishes”
  • In that data set I have a “category” field that is a list of “Categories” (another data set)
  • I want the user to be able to set the order of the dish uniquely in each “category”

Is there a way to do this?

Possible, but you need to be clear on exactly what you need. Please give clear examples and your expected input/output/behaviour etc.

Let’s say I have a dish called Garden Salad

The user can select categories from the category list and chooses: Salads & Vegetables.

There is a page where the categories are shown with each of the dishes assign to it.

I want the user to get able to make Garden Salad the 1st dish in salads and the 5th dish in Vegetables.

I can create an order (number) field but the order would be the same in every category.

Still things are not clear.

For example, not clear whether it is just a UI change you want user to make (in which case you can use custom states to achieve this) or whether you want it to be stored as well (in which case you need to create your new data type) where you create new record for such a change and selection done by user.

You are also not clear whether user is being shown only the categories they selected or all the categories (You said there are is a page where the categories are shown, which kind of implies all categories are shown).

Also, it is not clear of your first sentence “I have a dish called Garden Salad” as there was no use made of that selection. You didn’t say that user will be only shown categories that are relevant to the selected dish.

And so on.

Better to create wireframe maybe. Will help you think through exactly what you want and arrive at right data architecture.

I need the order to be stored.

The page with categories shows all categories.

I can create an order field and set the categories RG of dishes to Oder by the order field, but I would like each categories order to be different.

Based on your info, since you want a dish to be tied to a list of categories, but for each category (and user) the dish could be sorted in different orders. So in this case instead having a field list of categories for dish you will need to have just a single category for dish and the order will be set to dish, not to category.

Dish:

  • category
  • order
  • user
    etc…

Then, when the user are setting multiple categories to the same dish (let’s say using a multidropdown), you will need to create a dish for each category and also the desired order for each one.

And you can’t achieve it via option sets alone. Option sets are like readonly database.

You need to create a new data type which will have fields like user, dish, category, order etc for you to store what changes user made.