Forum Academy Marketplace Showcase Pricing Features

How to return data with a join?

I have a drop down menu that I’m trying to dynamically populate. The data is actually stored in two data types – Menu and Menu_Taxonomy). In the “Menu” data type I have the values (“Name”) that I want to display in the menu, but I need to only show a specific type of menu, so I need to first look in the Menu_Taxonomy to get unique IDs that relate to the right taxonomyand then search in the Menu data type with the Unique ID.

The “Menu” data type’s unique ID is stored in the related record on the “Menu_taxonomy”.

How can I create a drop down that essentially joins the two data types together to get the data needed?

UPDATE: This didn’t work after further review. It was adding all the menu items in the Term data type. For some reason it ignored step 6 where I tried to filter based on a value in the Term_taxonomy data type

I figured it out. Using the Choices Source option I was able to do the following in the drop down menu

  1. Select Type = Term
  2. Create Constraint
  3. Enter Unique ID = [Do a search for]
  4. Select Term_Taxonomy
  5. This open another window
  6. Create Constraint
  7. Enter taxonomy = nav_menu

It’s a little difficult to understand the flow because it’s not presented in a readable way in the Choices Source field once you’ve created it, but at least it works. :slightly_smiling:

I think you are probably overcomplicating the data structure, you don’t need to store ids of things in most instances.

Two Data Types, Menu and Menu_Taxonomy.

Have a field on Menu which has a Field Type of Menu_Taxonomy.

That way you can just do the constraint on Menu’s Menu_Taxonomy.

You really should not need to be storing ids and using them in “joins”. You join by embedding one data type in another.

@NigelG,

What gets stored in the menu_taxonomy field that is added to the Menu data type?

The taxonomy that it refers to.

Although maybe it works the other way round, so does a taxonomy have multiple menu items ?

Maybe an example would help ?

Yes, a taxonomy will have multiple terms. A term can only have one taxonomy.

The Term data type holds the name of the term – this could be for a navigational menu location, a category name, or some other type of data in the future. The other fields may be useful at a later date.

The Term_Taxonomy data type holds the taxonomy (nav_menu, category, tag, etc.) along with additional fields (parent item, description, etc.)

What I’m currently trying to accomplish is building a page that will allow me to create nav menus. These menus will be containers for menu items. For example: the “Left Sidebar” nav menu will hold menu items to specific pages. I hope to be able to then create a group that will dynamically display the menu items that I add to the “Left Sidebar” nav menu.

In this screenshot I have the field and button to create the nav menu

In this screenshot I have a drop down that should display the nav menus that were created.

The next part is yet to be built, but once a nav menu is selected then a user will be able to add related menu items to the nav menu in the white space shown below.

Then the menu and menu items will be set in a group like in this screenshot

Ok, so you can classify each Menu by have a field type related to the taxonomy.

Here is it working.

It allows a dynamically building drop down.

1 Like