Search code examples
azurefunctionkql

Passing dynamic parameter to Native function in Kusto


I have a native function with below schema

    let x= myNativeFunc (AccName :string, RG: string, Sub: string, StartTinme : datetime, EndTime : datetime, Threshold :int);
Now I have multiple set of data to pass to this function such as below :
  AccName = (acc1,acc2)  RG = (rg1,rg2) sub = (sub1,sub2)

Rest values can be hardcoded. Is there a way to pass such parameter to my native function with dynamic variable or using loop

Unable to use range or dynamic function. Need help on that else if there is any other way to achieve, that also would be great.


Solution

  • If you are giving string you need to send only string as input like below:

    let x = (key:string, value:string)
    {
     let r= strcat(key,value);
     print r
    }; 
    let c= x("rithwik","bojja");
    c
    

    Output:

    enter image description here

    If you want to send dynamic data then you need to make the type as dynamic like below:

    let x = (key:dynamic, value:dynamic)
    {
     let r= strcat(key,value);
     print r
    }; 
    let c= x(dynamic('rithwik,bojja'),dynamic('rithwik,bojja'));
    c
    

    Output:

    enter image description here