4 Replies Latest reply on Jun 14, 2012 10:33 AM by philmodjunk

    Using Get(FoundCount) and null



      Using Get(FoundCount) and null


      I'm using FMP11.

      So, I've create a loop that cycles through a table. Within the loop is a Find command that appears as such:




      Enter Find Mode

      Set Field [Master::Person; $Name]

      Set Error Capture [On]

      Perform Find []

      If [Master::Person = "William"]

      Set Field [Calculation::Will_Count; Get(FoundCount)]


      End Loop


      The process works, except when there is no record for that individual, the field is left blank... when I need it to become "0".

      The reason this is important is because later I use SUM(Will_Count) and it fails (contains a question mark) whenever there is a case where a person/field contains a blank space.

      Hopefully I explained the situation.  Any assistance would be helpful as this is the final step of my project.

        • 1. Re: Using Get(FoundCount) and null

          This makes no sense, as if there is no record for the individual then there is no where to set the field at 0 unless you create a new record with the person you just found but then the record count will be 1 not 0.

          If you want to count the 0, it won't matter how many 0 you pasted the sum(will_Count) will always be the same with 10 zeros or 0 zeros

          • 2. Re: Using Get(FoundCount) and null

            Sum should not return a ? if the field is empty.

            Sum ( Will_count ) is also not a syntax that will return anything different that just using Will_count. It's like saying "give me the sum of 5" and the sum of 5 is 5 so it makes no sense to use that syntax (but maybe you were posting imprecisely).

            Sum ( RelatedTable::will_Count ) from the context of a related table makes sense, it totals up the contents of the field for all related recors.

            Sum (RepeatingField ) works as this sums all the repetitions of a repeating field

            Sum ( Will_Count ; Jim_Count ; Fred_Count ) also works, but I wouldn't structure my data like that.

            You might look into summary fields and summary reports with sub sumary parts. This can produce totals like you describe here for a report and no looping script is required.

            • 3. Re: Using Get(FoundCount) and null

              In dealing with the above mentioned, I created a loop, placed the Get(FoundCount) results in a table, created new record for each other these instances, then used SUM(Will_Count) for the final calculation.

              Thanks for the assistance.

              • 4. Re: Using Get(FoundCount) and null

                There are much simpler ways to do this.