Registered users of this product or Trifacta Wrangler Enterprise should login to Product Docs through the application.
Computes a four-octet internet protocol (IP) address from a 32-bit integer input.
Source value must be a valid integer within the range specified by the formula below. A valid IPv4 address is in the following format:
NOTE: IPv6 addresses are not supported.
The formula used to compute the integer equivalent of an IP address is the following:
(aaa * 2563) + (bbb * 2562) + (ccc * 256) + (ddd)
So, the formula to compute this IP address is the following:
aaa = floor(Input / (256 3 ))
remainderA = Input - aaa
bbb = floor(remainderA / (256 2 ))
remainderB = remainderA - bbb
ccc = floor(remainderB / 256)
remainderC = remainderB - ccc
|ddd = remainderC|
Output = aaa + '.' + bbb + '.' + ccc + '.' + ddd
Numeric literal example:
Output: Generates a column containing the IP address
Column reference example:
Output: Generates the new ip_addr column containing the values of the
IpInt column converted to an IP address value.
|column_int||Y||string or integer||Name of column or integer literal that is to be converted to an IP address value|
For more information on syntax standards, see Language Documentation Syntax Notes.
Name of the column or integer literal whose values are used to compute the equivalent IP address value.
- Missing input values generate missing results.
- Multiple columns and wildcards are not supported.
|Required?||Data Type||Example Value|
|Yes||Integer literal or column reference|
Example - Convert IP addresses to integers
This examples illustrates how you can convert IP addresses to numeric values for purposes of comparison and sorting. This example illustrates the following functions:
IPTOINT- converts an IP address to an integer value according to a formula. See IPTOINT Function.
IPFROMINT- converts an integer value back to an IP address according to formula. See IPFROMINT Function.
Your dataset includes the following values for IP addresses:
When the above data is imported, the application initially types the column as URL values, due to the presence of the
https:// protocol identifiers. Select the IP Address data type for the column. The last three values are listed as mismatched values. You can fix the issues with the last two entries by applying the following transform, which matches on both
%? Trifacta® pattern matches zero or one time on any character, which enables the matching on both variants of the protocol identifier.
Now, only the
1.2.3 value is mismatched. Perhaps you know that there is a missing zero at the end of it. To add it back, you can do the following:
This page has no comments.