4 Replies Latest reply on Feb 14, 2017 11:44 PM by Stigge

    Question - Work with IP-Range

    Stigge

      Hi all

       

      I have 2 tables

      1 - Sites

      2 - Assets

       

      In "sites" i have 2 variables, <Start of IP Range> and <End of IP Range>

      example:

      Site1 =

      IP_Start = 10.10.10.1

      IP_End = 10.10.10.255

       

      Site2 = 

      IP_Start = 10.5.5.1

      IP_ENd = 10.5.5.255

       

      and in "assets" i have <IP>.

      example:

      Asset1 =

      IP = 10.10.10.141

       

       

      Relation:

      Asset  -   Sites

      <IP>   <  <IP_End>

      <IP>   >  <IP_Start>

       

      But i cant get it to show correct "Site" in my assets. Fields are text, tryed to do a calculated field GetAsNumber( <Field> ). and remade the relation to the number field instead. but i think it has problem to convert it to a number. not sure. But am guessing its some trick to use here.

       

      Anyone have any idea ?  =)

       

       

      Thank you

      /Stigge

        • 1. Re: Question - Work with IP-Range
          philmodjunk

          Your IP addresses represent text. You can't compare them as though they are numbers as "text rules" for comparing values will apply. With text, "20" > "200000000000000000" is a true statement.

           

          I think that you'd need to set up a calculation field that converts the entered IP address into something such as:

          IP_Startcompare = 10.5.5.001

          IP_ENDcompare = 10.5.5.255

           

          The addition of leading zeroes ensures that "text rules" for comparing values produces the same result as though comparing numbers.

           

          If the first part of the two IP addresses are always to be the same, you might also set up a calculation that extracts the final value (everything after the last period character) as a number to use for comparison purposes.

          • 2. Re: Question - Work with IP-Range
            Stigge

            Hi Philmodjunk

             

            problem is that the scoop is always different. only part that is always the same is the first section. 10.

            Then depending if they are remote connected it can be different from 10.001 to 10.009. but if they are located in an office. its always 10.205.xxx.xxx

            So the scoop is really changing :/

             

            But if i understand after googling around like crazy.. i need to devide the IP parts in to Part1, Part2, Part3 and Part4

            Problem is that i need to do that in the variable of the table in a calculation. and i dont know how :/

            • 3. Re: Question - Work with IP-Range
              philmodjunk

              As long as the number of digits in each section is the same, you do not need to insert leading zeroes.

               

              You can break down this string into parts very simply, however.

               

              GetValue ( Substitute ( "10.5.5.255" ; "." ; ¶ ) ; 1 )

               

              will return the text "10" (without the quotes). Just change the last parameter from 1 to 2, 3 or 4 to extract the other sets of digits.

              • 4. Re: Question - Work with IP-Range
                Stigge

                Phil,

                 

                 

                Thank you. That was exacly what i was needing. =)

                Had to do some minor changes, like skipping the last value of the ip scoop. but it works perfecly.

                 

                Thank you