1 Reply Latest reply on Dec 20, 2010 11:27 AM by philmodjunk

    Display list of field values, then click button to show rest of record



      Display list of field values, then click button to show rest of record



      I'm new to FM and I have searched like mad, but it's hard when you don't really know what to search on.

      I have a table called 'ingredients'. There fields 'ingredientName', 'purchaseQty', 'purchaseAmt', and 'costUnit' (and about 10 more)

      I am trying to find a way to have a screen that would list all the values from the 'ingredientname' in something that looks like a portal with a vertical scrollbar, and when an ingredient is selected, the other fields would populate to the right. I'm ok with clicking a button next to the ingredient name.

      This way a user could scroll through the list of ingredients, select one (click name or button) and then the details would appear on the layout. They could then edit the other fields if necessary. 

      I assume this could probably be done with another table that just held the ingredient name (it's unique) and related them, and use a portal to show the ingredient names, but I just can't get it.

      Any and all help would be appreciated. I attached a cruddy non-working mockup.


        • 1. Re: Display list of field values, then click button to show rest of record

          You are on the right track.

          Define at least two fields in your IngredientsList table:

          ID (auto-entered serial number)
          Name  (Text)
          Define all the other fields you need for this record

          Define a field, SelectedIngredient in your original table, which I will Call MainTable.

          Define two relationships between MainTable and IngredientsList. One relationship for your portal values to select from and one to display the selected record in a detail view listing all the additional fields.

          MainTable::SelectedIngredient x IngredientsList::ID    ( Double click the relationship line and change = to x to match all records )

          MainTable::SelectedIngredient = SelectedIngredientsList::ID ( Select the box for IngredientsList and click the button with two plus signs to make a second table occurrence of IngredientsList.)

          Now place a portal to IngredientsLIst on your MainTable layout. Put the Ingredients Fields you want displayed on your layout by selecting them from SelectedIngredientsList.

          Your button can perform this script to display the selected Ingredient Record:

          set Field [MainTable::SelectedIngredient ; IngredientsList::ID]
          Commit Record

          And you can use conditional formatting to highlight the selected row in your portal.

          Note: this is for display purposes only. If you want to link a given ingredient to a given MainTable record as part of a process of building a list of ingredient records, you will need a more sophisticated implementation of this basic approach.