calling scalar functions in datatable array

%3CLINGO-SUB%20id%3D%22lingo-sub-192810%22%20slang%3D%22en-US%22%3Ecalling%20scalar%20functions%20in%20datatable%20array%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-192810%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20works%20as%20expected%3A%3C%2FP%3E%3CPRE%3Edatatable%20(TimeGenerated%3Adatetime%2C%20Success%3Abool)%20%5B%20datetime(%222018-05-11T17%3A50%3A01.665%22)%2C%20true%20%5D%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3EBut%20this%20fails%20because%20the%20array%20does%20not%20allow%20scalar%20functions%20to%20be%20called%3F%3C%2FP%3E%3CPRE%3Edatatable%20(TimeGenerated%3Adatetime%2C%20Success%3Abool)%20%5B%20now()%2C%20true%20%5D%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3EAccording%20to%20this%20%3CA%20title%3D%22DateTime%20Datatypes%22%20href%3D%22https%3A%2F%2Fdocs.loganalytics.io%2Fdocs%2FLanguage-Reference%2FData-types%2Fdatetime%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Edocumentation%3C%2FA%3E%2C%20datetime()%20and%20now()%20are%20both%20%22datetime%20literals%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECould%20we%20add%20support%20for%20this%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-192810%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EQuery%20Language%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-195681%22%20slang%3D%22en-US%22%3ERe%3A%20calling%20scalar%20functions%20in%20datatable%20array%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-195681%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Patrick%2C%3C%2FP%3E%0A%3CP%3EIt%20appears%20%3CA%20href%3D%22https%3A%2F%2Fdocs.loganalytics.io%2Fdocs%2FLanguage-Reference%2FTabular-operators%2Fdatatable-operator%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Edatatable%20%3C%2FA%3Eexpects%20only%20constant%20scalar%20values%2C%20whereas%20now()%20is%20an%20expression.%3C%2FP%3E%0A%3CP%3ESo%20that%20explains%20it..%3C%2FP%3E%0A%3CP%3EI've%20mentioned%20support%20for%20it%20is%20requested.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHTH%2C%3C%2FP%3E%0A%3CP%3ENoa%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-193329%22%20slang%3D%22en-US%22%3ERe%3A%20calling%20scalar%20functions%20in%20datatable%20array%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-193329%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20seems%20like%20a%20bug.%20I've%20report%20it%20to%20the%20language%20team%20and%20awaiting%20their%20answer.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

This works as expected:

datatable (TimeGenerated:datetime, Success:bool) [ datetime("2018-05-11T17:50:01.665"), true ]


But this fails because the array does not allow scalar functions to be called?

datatable (TimeGenerated:datetime, Success:bool) [ now(), true ]


According to this documentation, datetime() and now() are both "datetime literals"

 

Could we add support for this?

2 Replies
Highlighted

This seems like a bug. I've report it to the language team and awaiting their answer.

Highlighted

Hi Patrick,

It appears datatable expects only constant scalar values, whereas now() is an expression.

So that explains it..

I've mentioned support for it is requested.

 

HTH,

Noa