I am trying to send the output from table recordtime value to Function1 as a parameter value. but i am getting below error for Function1()
semantic error: SEM0100: 'toscalar' operator: Failed to resolve scalar expression named 'recordtime'.
I tried with recordtime as passing as tostring()
and todatetime()
Function definitions:
Function1(fromdate string,recordtime string)
Function2(fromdate string,enddatetime string)
Main (startdate,enddatetime,id)
Function Main (startdate,enddatetime,id){
TestTable
| where (fromdate >= datetime(startdate)
and todate <= datetime(enddatetime))
and deviceid == id
| summarize cnt = count(), recordtime = Timestamp
| extend getdates = case (
cnt == 1,toscalar(Function1(startdate,recordtime)),
cnt == 2,toscalar(Function2(startdate,enddatetime )),
"Out of range"
)
| Project getdates
}
Function1 and Function2 returns single array like ([{"fromdate":"2020-03-11T16:39:47.6730000Z"},{"todate":"2020-03-11T16:44:23.8800000Z"}]
any suggestions, Thanks in advance