none
kusto function returning "Body of the callable expression cannot be empty" RRS feed

  • Question

  • let TxMachIdFinder = (teamName:string)
    {
    traces
    | where message contains teamName and message contains "Not Mapped"
    | extend TXmatchId = extract("(\\d+)", 1, message)
    | extend CompetitionDate = extract("(\\d{1,2}/\\d{2}/\\d{4} \\d{1,2}:\\d{2}:\\d{2} \\s?(AM|PM))", 1, message)
    | distinct teamName, TXmatchId , CompetitionDate , message
    };

    TxMatchIdFinder("random")

    It's a very simple function but it returns "Body of the callable expression cannot be empty".

    it does work as a query below though

    let teamName="Manchester";
    traces
    | where message contains teamName and message contains "Not Mapped"
    | extend TXmatchId = extract("(\\d+)", 1, message)
    | extend CompetitionDate = extract("(\\d{1,2}/\\d{2}/\\d{4} \\d{1,2}:\\d{2}:\\d{2} \\s?(AM|PM))", 1, message)
    | distinct teamName, TXmatchId , CompetitionDate , message


    Wednesday, August 28, 2019 3:32 PM

All replies

  • Hi Ariel,

    Thanks for using Azure. 

    Based on a sample data set i have, tested below queries and it works as expected. 

    let teamName="namespace";
    
    traces
    | where message contains teamName and message contains "not be found" 
    | extend TXmatchId = extract("(\\d+)",1, message)
    | extend CompetitionDate = extract("(\\d{1,2}/\\d{2}/\\d{4} \\d{1,2}:\\d{2}:\\d{2} \\s?(AM|PM))",1, message)
    | distinct teamName, TXmatchId , CompetitionDate , message

    output : 

    Calling the user defined function 

    let TxMatchIdFinder = (teamName:string)
    {
    traces
    | where message contains teamName and message contains "not be found" 
    | extend TXmatchId = extract("(\\d+)",1, message)
    | extend CompetitionDate = extract("(\\d{1,2}/\\d{2}/\\d{4} \\d{1,2}:\\d{2}:\\d{2} \\s?(AM|PM))",1, message)
    | distinct teamName, TXmatchId , CompetitionDate , message
    };
    
    TxMatchIdFinder("namespace")

    Output from running above query is 

    Hope the above information helps. Please feel free to revert back if you have any further queries. 


    Wednesday, August 28, 2019 4:51 PM
    Owner