Skip to Content
avatar image
Former Member

How do I convert IP addresses in Decimal to dotted quad?

I have an MS-SQL database I will be querying that has IP addresses stored as Integers.

This is great for sorting IP address in the database.

When I report with Crystal, I will need these IP's converted from Decimal to Dotted Quad.

An example of the data is:

Decimal: 3232235778
Dotted Quad: 192.168.1.2

I am wondering if anyone has ever done this using Crystal Reports with this type of data before.

Thank you for any assistance.

-= Bruce D. Meyer

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Apr 08, 2017 at 01:36 PM

    You can implement this as a User Function Library (UFL) function.
    I just added 2 functions to my UFL and, as shown below, they take care of Number to Dot conversion as well as the reverse.
    .Net provides built in functions to handle this type of logic.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I didn't see this until long after you posted it. I ended up converting all the IntegerIP's to dotted quad on the source file using Powershell. Your answer however, is instructional. I learned I can apparently expose .Net functionality inside of Crystal via a UFL. Thank you for the teaching.

  • Apr 07, 2017 at 08:34 PM

    Hi Bruce,

    I haven't done it but Google is my friend.

    https://drive.google.com/file/d/0B8jeLxypP81_N0FSQXRMdWpZZWs/view

    You should be able to translate these formulas from Excel into Crystal.

    Good luck,

    Brian

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thank-You Brian. I did google, but apparently, not as proficient as you!

      I didn't see this until long after. I ended up converting on the back end. I can't access google drive from work also. :-) Didn't realize I can use excel formula's in Crystal. That's going to be handy.

      -= Bruce