3 Replies Latest reply on Aug 20, 2014 7:39 AM by marty72

# Set Text Field based on various Numeric Values

I have a data collection solution being used on an iPad. This solution collects data in order to assess a number of parameters about trees in forested areas. One of the items collected for each each tree in the assessed areas is what species it is e.g. Hard Maple, White Pine, etc. I need to populate a text field called Species_Composition that describes the percentage of that each species represents within the forested area.

The format of this field when previously filled in by hand is a follows: MH 7 PW 2 BF 1 which would represent Hard Maple 70%, White Pine 20% and Balsam Fir 10% for a total of 100%.

There are 30 different tree species that can be represented in this description but most times only 4 to 8 species will occur in an assessment area and the maximum number that will occur in this Species_Composition field will be 10 (100%). The values in the text field also have to show from largest to smallest.

I can use the data collected to calculate a % of each species that occurs in an area which I can than round to get a single digit number ( 70% - 7 ). Any trees that round to less than 10% or 1 would be dropped leaving the rest to use for populating the text field.

I am looking for some advice as to how to approach this problem. Should I attempt to do this with a number of tree variables or fields? I have read a bit about arrays and I am wondering if this would be the way to approach it?

Any help would be appreciated.

Marty

• ###### 1. Re: Set Text Field based on various Numeric Values

marty72 wrote:

The format of this field when previously filled in by hand is a follows:  MH 7 PW 2 BF 1 which would represent Hard Maple 70%, White Pine 20% and Balsam Fir 10% for a total of 100%.

There are 30 different tree species that can be represented in this description but most times only 4 to 8 species will occur in an assessment area and the maximum number that will occur in this Species_Composition field will be 10 (100%). The values in the text field also have to show from largest to smallest.

Use a table called, say, TreesInObservation, where each record is a count of a tree species in an assessment, and thus would be a child table to an Assessment (?) table – at any rate, the table where the hand-filled field now resides.

Storing your figures this way allows you to create a report layout, use portal filters, perform SQL magic and lots of other goodness (even re-creating your old field) that with a text list would be next to impossible to achieve.

Try working along the lines of

AssessmentArea --< Assessment --< SpeciesInAssesssment (speciesID, count) >-- Species

where

MH 7 PW 2 BF 1

would become 3 records with fields and values like

assessmentID: 6 , speciesID: x, count: 7

assessmentID: 6 , speciesID: y, count: 2

assessmentID: 6 , speciesID: z, count: 1

where assessmentID denotes the parent table, and x, y, z correspond to the primary IDs of the records with the code MH, PW and BF, respectively, in a Species table.

You can display these records in a portal, list them in a report, calculate them into a text field etc.

marty72 wrote:

I have read a bit about arrays and I am wondering if this would be the way to approach it?

FilkeMaker is (first and foremost) a database, not a programming language/environment; arrays (or their Filemaker equivalents – lists and repeating field) are mostly used for scripting and UI purposes, i.e. in a temporary manner, not for persistent data storage.

• ###### 2. Re: Set Text Field based on various Numeric Values

I might suggest that you set up a database for the collection of data using the iPad and using three fields: area_name; species; count.  The person in the field can walk around the area, use a dropdown list of species and enter a count of trees in that particular area.  He can then mave to another area, select this area by name (or give it a name) and do the same again.

The collected data or, the historical data can then be displayed in a table format.  Down the left side use a list of the sample areas by name and across the top list the species.  Then use summary fields to count the numbers of each species and their respective percentages of the total.  Finally, display this information in the table format I descrided.