Kernel 8.0 APIs Banner [skip navigation]
Office of Information & Technology (OIT) Banner

$$CONVERT^XLFIPV(): Convert any IP Address to Standardized IP Address Format

Reference Type: Supported, Category: IP Address Functions, Integration Agreement: 5844

Description

This extrinsic function converts an Internet Protocol (IP) address (either IPv4 or IPv6) into an IP address in a standardized format, depending upon the system settings:

Format

$$CONVERT^XLFIPV(ip)
Input Parameters: ip: (required) IPv4 or IPv6 address (string; in quotes) to be converted
Output: returns:
  • An IPv4 address if IPv6 is disabled on the system.
  • An IPv6 address if IPv6 is enabled on the system.
  • An IPv4 or IPv6 null address if the input cannot be converted.

 

Examples

Example 1 (IPv6 Enabled)
>S X=$$CONVERT^XLFIPV("10.126.3.1")
>W X
0000:0000:0000:0000:0000:FFFF:0A7E:0301
  
Example 2 (IPv6 Disabled)
>S X=$$CONVERT^XLFIPV("10.126.3.1")
>W X
10.126.3.1
  
Example 3 (IPv6 Enabled)
>S X=$$CONVERT^XLFIPV("2001:db8::8a2e:370:7334")
>W X
2001:0DB8:0000:0000:0000:8A2E:0370:7334
  
Example 4 (IPv6 Disabled)
>S X=$$CONVERT^XLFIPV("2001:db8::8a2e:370:7334")
>W X
0.0.0.0