5 Replies Latest reply on May 20, 2010 2:06 PM by MikhailEdoshin

    Pulling Format types based on a trigger

    kingsley47

      Title

      Pulling Format types based on a trigger

      Post

      I am using filemaker pro to create test reports for our customers. In the test report is a section for chemical reuqirements and reported chemistry. Depending on the material used, a different set and number of fields for the elements will need to be listed. If I have a field asking for the material type could I use that to prompt filemaker to pull up a set of fields for each material type? I need the chemical abreviations pulled up with a blank box under to state the percentage.

       

      Example: 
      (bf = blank field)

       

      Mat'l Type: 4340

       

      C       Mn       P        S........etc..(10 fields total)

      bf      bf          bf       b

       

      Mat'l Type:718

       

      Ni      Cr        Mn....etc.... (16 fields total)

      bf     bf        bf       

        • 1. Re: Pulling Format types based on a trigger
          ryan

          Are the blank boxes under the chemical abbreviations: Are those to list the percentages or are they to allow the user to input percentages mannually?

          • 2. Re: Pulling Format types based on a trigger
            philmodjunk

            Filemaker is more flexible if you can keep the number of columns static and simply add more rows. If you can work with a layout where the data looks like this:

             

            Ni       bf         

            Cr       bf        

            Mn      bf

             

            It gets a lot easier to implement as you can simply add more records as you need more rows. This is particularly true for data entry. For reporting purposes, there are ways you can get the format you want once the data has been entered.

            • 3. Re: Pulling Format types based on a trigger
              kingsley47

              How would I go about doing the whole thing?

              • 4. Re: Pulling Format types based on a trigger
                philmodjunk

                I'm not sure from your posts, what you mean by the "whole thing". :smileywink:

                 

                For starters, I'd define at least three tables: tests, materials and Measurements.

                 

                Tests::TestID = Measurements::TestID (Enable allow creation of records... for Measurements)

                Tests::MaterialID = Materials::MaterialID

                 

                Define a portal to Measurements on a Test layout

                A field in Materials can list the elements for which measurements will be recorded for that material.

                 

                Tests::MaterialID can be formatted whith a drop down that lists materials in a two column value list.

                A script trigger on this field can trigger the following script:

                 

                Set Variable [$Elements ; Value: Materials::Elements ]

                Set Variable [$TestID ; Value:Tests::TestID

                Freeze Window

                Go To layout [Measurements]

                Set Variable [$I ; Value:1 ]

                Loop

                    Exit Loop If [$I > ValueCount ( $Elements ) ]

                    New Record/Request

                    Set FIeld [ Measurements::TestID ; $TestID ]

                    Set Field [Measurements::Element ; GetValue ( $Elements ) ]

                    Set Variable [$I ; Value: $I + 1]

                End Loop

                Go To Layout [original layout ]

                 

                with this method, you'd store your list of elements vertically in one field with a return after each element name or abbreviation. One such field migh look like this in the Materials table:

                Pb

                As

                I

                Hg

                 

                With that approach, selecing a material will populate the portal with a list of elements for which you will be recording measurements.

                 

                See if you can get this part, data entry, working and then we'll look at how a report might list this in a single horizontal row.

                 

                 

                 

                • 5. Re: Pulling Format types based on a trigger
                  MikhailEdoshin

                  Assuming that you're happy with using repeating fields, the solution would be that:

                   

                  1. Make a table with report templates: Material and a repeating field that lists all elements that need to be reported for this materail.
                  2. Make a table with reports. Each report will have a Material field, a repeating field to list elements and a repeating field that lists results for this element.
                  3. Make a relationship Report::Material = Template::Material.
                  4. Set the Report::Elements to lookup Template::Elements.

                  Now when you add a new report and select its material, you'll get all elements that need to be reported for this material.

                   

                  Most developers frown upon using repeating fields for data. In this case the solution would be more complex:

                   

                  1. Add two more tables: Template Element, Report Element. These tables need to be linked to Template or Report respectively and their records will take the place of repeating fields.
                  2. Write a script that fires when you select another material in Report and make it to delete existing report lines and then go to the selected template, find all its lines and for each create a new record in the Report LIne table.