IP Protocol (ipprotocol)
Converts an IP protocol name to its protocol code or vice versa. Learn more about IP protocol values here.
How does it work in the search window?
Select Create column in the search window toolbar, then select the IP Protocol operation. This operation needs only one argument. You can choose a column that contains protocol names (string) or protocol codes (integer).
Integer/String to convert (mandatory)
Be aware that the values used as arguments need to correspond to valid protocol names in case you use an integer or to valid protocol numbers in case you use a string. Otherwise, the operation will return null values in the newly created column.
The data type of the new column is string if the input was integer, or integer if the input was string.
The examples in this article use values in a data table generated from this CSV file. If you want to try the example for yourself, download the file and upload it to your domain clicking Data upload in the navigation pane. Name the new table
my.upload.sample.data and select Current date as Date parsing type. Learn more about uploading data in Uploading log files.
After receiving the confirmation message, you can access the table from the Finder, selecting my → upload → sample → data. When you upload data from a file, all the information is included in a single column called message. To split the values and extract those we need for this operation into a new column, you can use the Split operation. Then you need to transform the string in the newly created column into integer using the To Int operation. Click Toggle Query Editor in the search window toolbar and paste the following LINQ query to save time:
select split(message, ";", 17) as ProtocolCodeString
select int(ProtocolCodeString) as ProtocolCode
my.upload.sample.data table, we want to transform the protocol numbers in the ProtocolCode column into protocol names. To do it, we will create a new column using the IP Protocol operation.
The arguments needed to create the new column are:
- Integer to convert - ProtocolCode column
Click Create column and you'll see the new ProtocolName column containing string values corresponding to the protocol names.
How does it work in LINQ?
Use the operator
as... to apply the Create column operation. These are the valid formats of the operation:
You can copy the following LINQ script and try the above example on the
my.upload.sample.data table. As said above, keep in mind that you must download and upload the file provided before to your Devo domain.
from my.upload.sample.data select split(message, ";", 17) as ProtocolCodeString select int(ProtocolCodeString) as ProtocolCode select ipprotocol(ProtocolCode) as ProtocolName