Justin Mathew
Justin Mathew

Reputation: 1046

Why this simple kusto script is not working?

The below print statement always returns empty string. Why is it happening?

let tspanString=strcat(tostring(toint(rand(100))),'d');
print totimespan(tspanString)

Upvotes: 0

Views: 630

Answers (1)

Yoni L.
Yoni L.

Reputation: 25895

the result of strcat(N, 'd') is a non constant string in a format that can't be parsed into a timespan literal, when passed into totimespan().

A valid alternative in your case would be using rand(100) * 1d

See: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/datetime-timespan-arithmetic

Upvotes: 1

Related Questions