Split Function in Kusto Query (KQL) How to split string into values in Kusto Query Language - 2022

Topic:  Split Function in Kusto Query (KQL) How to split string  into values in Kusto Query Language


In this article, we are going to learn about Split function in Kusto Query Language, Splits a given string according to a given delimiter and returns a string array with the contained substrings, optionally, a specific substring can be returned if exists. Kusto Query Language is a powerful tool for exploring your data and discovering patterns, identifying anomalies and outliers, creating statistical modeling, etc.


 //split  
 // Splits a given string according to a given delimiter and returns a string array with the contained substrings.  
 //Optionally, a specific substring can be returned if exists.  
   
 //Let's create a table Customer  
 //.drop table Customer  
 .create table Customer (CustomerId: long, FName: string,LName:string,FileLocation:string )   
  .ingest inline into table Customer <|  
 1,Aamir,Shahzad,C:\Documents\Newsletters\Summer2018.pdf  
 2,Raza,ALI,D:\Documents\MyTestFileLocation\Tax_2019.pdf  
 3,Lisa,  
 4,steve,Ladson  
 5,Robert,Jr  
 ,aamir,ali  
   

   
 // split the values into an Array  
 Customer  
 | extend split(FileLocation,'\\')  
   

 // Let's divide the results into sub arrays  
 Customer  
 | extend DriveName=split(FileLocation,'\\',0), MainFolder=split(FileLocation,'\\',1),Subfolder=split(FileLocation,'\\',2),FileName=split(FileLocation,'\\',3)  
   
 
  
 //Let's get the value from the arrary and print in nice readable way  
 Customer  
 | extend MyArrary=split(FileLocation,'\\')  
 | extend DriveName=MyArrary[0],Mainfolder=MyArrary[1],SubFolder=MyArrary[2],FileName=MyArrary[3]  

3 comments:

  1. my name is James marry. And I am a student. today I am search the best essay writer service for my work. And I seen your post. you talk about this topic very well. I read it. And I appreciate your writing and describing skills. keep It up. And thanks to share this site with us.

    ReplyDelete
  2. Tool for exploring your data and How To Use A Hair Mask: A Step-By-Step Guide
    discovering patterns, identifying anomalies and outliers, creating statistical modeling, etc.

    ReplyDelete
  3. As a student striving for excellence in the UK, I rely on assignment help UK. Their team of experts consistently produces high-quality work, ensuring that I meet the rigorous academic standards.

    ReplyDelete