I'm trying to write a Kusto query that will union myUnion
with AppTraces
logs. All works until I declare ItemCount
column as part of myUnion
results. You can do this with other columns, e.g. TimeGenerated
.
The error returned is
'project' operator: Failed to resolve scalar expression named 'ItemCount'
let countRequests = 5;
let myUnion = union (print
TimeGenerated = now(),
Message = "MyMessage",
ItemCount = countRequests);
AppTraces
| union myUnion
| project
TimeGenerated,
ErrorMessage = Message,
ItemCount
| order by TimeGenerated asc
Possible workaround: I can name myUnion.ItemCount
something else and coalesce, but I'd preferably like to use the built-in ItemName
.
you might have a conflicting column named ItemCount
with a different datatype in your table named AppTraces
.
what does the following return?
let countRequests = 5
;
let myUnion = print TimeGenerated = now(),
Message = "MyMessage",
ItemCount = countRequests
;
AppTraces
| union myUnion
| getschema
if you see two columns with different datatypes, for example ItemCount_int
and ItemCount_long
- you'll want to align the data types (e.g. by switching to let countRequests = int(5)
)