Happy Holidays! Draw a tree with KQL

This post has been republished via RSS; it originally appeared at: Azure Data Explorer Blog articles.

KQL isn't just super-powerful, it's also fun!
See how you can draw a tree using KQL and learn some of the functions and operators available.
Inspired by https://lnkd.in/eCgFzBTw. Feel free to design and share your own trees!



let tree_height = 10; range i from 0 to tree_height * 2 step 2 | extend side_width = tree_height + 1 - i / 2 | extend side_space = strcat_array(repeat(" ", side_width), " ") | project Happy_Holidays = case(i != 0, strcat(side_space, "O", strcat_array(repeat("V", i - 1), ""), @"O", side_space), strcat(side_space, " O", side_space))





let L=10; range x from 1 to L step 1 | project t=strcat(strrep(' ', L-x), strrep('.', x), strrep('*', x-1)) | summarize Tree=make_list(t) | project Tree=array_concat(pack_array(strcat(strrep(' ', L-3), make_string(127775))), Tree) | project HappyXmas=strcat_array(Tree, '\n')




REMEMBER: these articles are REPUBLISHED. Your best bet to get a reply is to follow the link at the top of the post to the ORIGINAL post! BUT you're more than welcome to start discussions here:

This site uses Akismet to reduce spam. Learn how your comment data is processed.