3 Replies Latest reply on Dec 12, 2011 12:57 PM by mgores

    Need Script help

    RobertA

      Title

      Need Script help

      Post

      Hey guys!

      new to the forum and a novice at filemaker pro 11.  Currently, I am atempting to create a script that will allow me to acheive a summary of total results while excluding repeating data points. 

      For example, I have a barrel with alot of items inside of it that are taged individually.  On each one of those individually tagged items are associated codes unique to that item.  The script that I am attempting to write sums up all the unique codes while excluding repeats to acheive a results summary page of codes per barrel. 

      I know that this should be an easy loop script with if, then tests, but am unfamiliar with scripting and new to how filemaker uses script.  can anyone possibly help me out with this, or does anyone have a script in their toolbox from a previous database that does this...it may be a script that alot of people use (ie. basic script). 

      here is what i have so far...

      Show All Records

      Enter Find mode [Pause]

      Perform Find

      Go to Record/Request/Page [First]

      Loop

      If (Waste tags::waste code 1  &  If ( Waste tags::waste code 2  ≠ Waste tags::waste code 1 ; Waste tags::waste code 2 ; " ")  &  If (Waste tags::waste code 3 ≠ Waste tags::waste code 1 & Waste tags::waste code 3 ≠ Waste tags::waste code 2; Waste tags::waste code 3; " ") & If (Waste tags::waste code 4 ≠ Waste tags::waste code 1 & Waste tags::waste code 4 ≠ Waste tags::waste code 2 & Waste tags::waste code 4  ≠ Waste tags::waste code 3; Waste tags::waste code 4 ; " ")

      End If

      Then

      End Loop

      The "if" statment that I use does what I ask, but only for a single tag...how can I get the script to loop through each tag within the Drum and check the codes to see if their are repeats and exclude repeats and only populate the new codes. 

       

      Thank you all for your time and efforts, i really appreciate the help!

       

       

       

        • 1. Re: Need Script help
          mgores

          Are you looking for a total count of unique items or for a count of each unique item?  There is a technique called "Sum the Reciprocal" that will give you the number of unique values.

          • 2. Re: Need Script help
            RobertA

            Hey Mark,

            Thank you for your promp reply! 

            I beleive I am looking for a count of each unique item in terms of codes per tag...perhaps this may be a better way of explaining my situation.

            i have a Barrel

            within that barrel I have 3 tagged items.

            on each tag;

            tag 1 = codes 001,002,003

            tag 2 = codes 001, 002, 005, 008

            tag 3 = codes 005, 008, 007,

             

            what I need is a total code summary broken down by each tag to give me a concat of total codes/drum.

            i.e. script runs through each tag and sums up codes and excludes repeating numbers to = 001, 002, 003, 005, 007, 008  (summary for this drum)

            hope this clairfyies things!

             

            thanks again for all your help guys!

             

             

            • 3. Re: Need Script help
              mgores

              Am thinking it would probably be easier if there were 4 tables

              Barrels --<Tags ---< Tag_Code>---Codes

              BarrelID = BarrelID  = BarrelID  

                             TagID     = TagID 

                                             CodeID  =  CodeID

               

              This would give you the flexability to have as many codes per tag as you needed and you could display a portal on your barrel layout to show records from the Tag_Code table which would list the Codes in that barrel.