Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Replace empty value in dictionary Kusto

I have this data:

let data = datatable(Timestamp:datetime, Name:string, Value:int)
            [
             datetime(2022-02-18 10:00:00 AM), "Floor 1", 100,
            ];
    let mydict = dynamic(
        {
             "Id":"1",
             "Product": ""
        }
    );
data
| extend messageMetaData = mydict
| project Timestamp, Name, Value, messageMetaData = replace_string(tostring(messageMetaData), "", "Wheat")

What I am trying to achieve here is to replace the empty value in messageMetaData by a string. When running this code it is giving me the exact same result/

Expected result:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

>Solution :

print mydict = dynamic({"Id":"1", "Product": ""})
| extend messageMetaData = replace_string(tostring(mydict), '""', '"Wheat"')
mydict messageMetaData
{"Id":"1","Product":""} {"Id":"1","Product":"Wheat"}

Fiddle

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading