2 Replies Latest reply on Oct 17, 2008 6:16 PM by RealEstateAcademy(Australia)

    Street Number Calculation

    RealEstateAcademy(Australia)

      Title

      Street Number Calculation

      Post

       I have this calculation it pulls the nmbers for me from an address field but I need it to pull more data it works fine for normal properties 6 test street or 6-8 test street but I would also like it to gather the info for addresses like 38/6-8 test street. What do I need to do to get this calculation to find the regular street numbers and the longer ones?

       

        Case(PatternCount(vendor_street; "/")  > 0; Right (LeftWords ( vendor_street; 1); Length ( LeftWords ( vendor_street; 1)) - Position ( LeftWords ( vendor_street; 1); "/"; 1; 1)); LeftWords(vendor_street; 1))

        • 1. Re: Street Number Calculation
          davidhead
            

          I think what you need to define are the business rules you would like to apply. What are the possible addresses that the you the calculation to handle? And what is it that you want to extract from each? If you can post the full range of possibilities and what you want to extract, we should be able to extend your calculation for you.

           

          Certainly there is a clearer way to write what you have already:

           

          Let ([

          firstword = LeftWords ( vendor_street; 1)

          ];

          If(

          PatternCount( firstword ; "/") ; 

             Right ( firstword; Length ( firstword ) - Position ( firstword ; "/"; 1; 1)); 

             firstword

            )

          )

           

          The question is - what else do you want it to do? 

          • 2. Re: Street Number Calculation
            RealEstateAcademy(Australia)
              

            Thanks David,

            Your a champion!

            I wanted to be able to extract all of the numbers whether they were formatted in either of these ways. 

            6 test street

            6-8 test street

            35/6-8 test street

             

            I used your calculation which was much easier to understand and added or "-" which looks to bring across the data I was looking for.

            Let ([
            firstword = LeftWords ( vendor_street; 1)
            ];
            If(
            PatternCount( firstword ; "/" or "-" );   Right ( firstword; Length ( firstword ) - Position ( firstword ; "/" or "-"; 1; 1));
               firstword
              )

            )