11 Replies Latest reply on Jan 4, 2016 6:13 AM by rpridenh

    Even & Odd data in fields

    kjcohio

      How do I create a column that pulls just odd or even numbered data in Filemaker Pro 12?

       

      Thanks!

        • 1. Re: Even & Odd data in fields
          erolst

          A value is odd if

           

          Mod ( value ; 2 )

           

          consequently, it is even if

           

          not Mod ( value ; 2 )

          • 2. Re: Even & Odd data in fields
            SteveMartino

            Little more info would be helpful. A better description of what you are trying to achieve would get better responses.

            Where does the data come from, and what does it look like?

            When you say "...pulls just odd or even numbered data...", that would be all data .  Do you want one column for odd data and one column for even data?

            • 3. Re: Even & Odd data in fields
              erolst

              SteveMartino wrote:

              A better description of what you are trying to achieve would get better responses.

              What, you don't like my response?

               

              But yes, context/background info is always helpful.

              • 4. Re: Even & Odd data in fields
                kjcohio

                OK thanks - here's what I'm trying to do.

                 

                I have street addresses and the street number is in it's own field.  I'd like to have a report that lists all the even addresses in one column and all the odd addresses in a another column.  (Both sides of the street)

                • 5. Re: Even & Odd data in fields
                  kjcohio

                  OK thanks - here's what I'm trying to do.

                   

                  I have street addresses and the street number is in it's own field.  I'd like to have a report that lists all the even addresses in one column and all the odd addresses in a another column.  (Both sides of the street)

                  Hope that helps.

                  • 6. Re: Even & Odd data in fields
                    erolst

                    kjcohio wrote:

                    a report that lists all the even addresses in one column and all the odd addresses in a another column.

                     

                    Then create a calculation field with one of the above expressions, using the streetNumber field; this calc field will return 0 or 1; sort on it – ascending or descending, depending – and fiddle with the print column settings; this may get complicated if you need to print multiple pages.

                    • 7. Re: Even & Odd data in fields
                      SteveMartino

                      "...What, you don't like my response?..."

                       

                      LOL...We posted at the same time.  I didn't see your response until the screen refreshed

                      • 8. Re: Even & Odd data in fields
                        kjcohio

                        Thank you both.  I've got a long way to go in grasping this but I appreciate your help.

                        • 9. Re: Even & Odd data in fields
                          rpridenh

                          did you ever get that working?

                          I'm doing the exact same thing on a project.

                          Using the Mod function, i created a field that calculates to the word "Odd" or "Even". It's called "SideOfStreet"

                          Then I sort on that field first, and on the address number second.

                          Setup a report layout that prints in 2 columns. Add a sub-summary that keys on the SideOfStreet field and adds a page break after each group.

                           

                          Here is the problem I ran into: Some of the streets in the list only have Odd or Even addresses.

                          In these cases, my left and right columns get out of sync. i haven't figured out how to work around this other than to throw in some dummy records with the appropriate address. But this leads to other issues if one wants to count the number of houses, for example.

                           

                          street_report.JPG

                          • 10. Re: Even & Odd data in fields
                            SteveMartino

                            So what your saying is your report has 2 columns.  If you have a street, say Elm with only Odd numbers, you want your report to leave a blank for the even side, for that page, and continue on the next page with, lets say Oak, with 2 columns, odd & even.

                            • 11. Re: Even & Odd data in fields
                              rpridenh

                              SteveMartino

                              Thanks for chiming in on this!

                              Yes that's correct Steve. In my database, some of the streets have only Even addresses and some only Odd. Many have both. And just to add another monkey wrench; some have blanks for the address (i.e., an empty lot may have no assigned street number), so it then wants to span 3 columns. But those can be handled, I just put in zero or 1 to force it as in the screen shot I posted.

                              Also just FYI, each street has an ID number assigned (shown in the header), and each record has a "Sequence" number, but the sequence number is not relevant to this layout. The header with the street number, street name, and column headings (Status, Name, STNO, and Seq) is contained in a leading sub-summary part so that it appears at the top of each column. Then there is a trailing sub-summary part which contains the note "End of side" so I can track where each group of odd/even addresses breaks. This part is set to have a page break after each "1" occurrence, which forces the column break or page break as the case may be. (The SideOfStreet field is not shown.

                              One unfortunate thing with the data is that in some cases the user assigned more than one street name to the same street ID number for his own purposes. No big deal, I use the street name as the primary sort, and SideOfStreet as the secondary sort.