question

SkorMMSC-3492 avatar image
0 Votes"
SkorMMSC-3492 asked PRADEEPCHEEKATLA-MSFT commented

KQL using make_string() function in datatable[] scope

I am facing some issues with the make_string function. The following command

 print str = make_string(75, 117, 115, 116, 111)

returns "Kusto" as expected, but it is not possible to use this function in the datatable scope. The following kql:

 datatable (Input: string) [
     make_string(75, 117, 115, 116, 111)
 ]

returns error message:

Syntax Error 

 A recognition error occurred. 
 Token: make_string 

 Line: 2, Position: 4


Do you have any idea, why it does not work?

azure-data-explorer
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @SkorMMSC-3492,

Following up to see if the below suggestion was helpful. And, if you have any further query do let us know.


  • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.

0 Votes 0 ·

1 Answer

PRADEEPCHEEKATLA-MSFT avatar image
1 Vote"
PRADEEPCHEEKATLA-MSFT answered PRADEEPCHEEKATLA-MSFT commented

Hello @SkorMMSC-3492,

Thanks for the question and using MS Q&A platform.

As per the documentation - datatable operator , the datatable operator only accepts scalar values.

193835-image.png

Hope this will help. Please let us know if any further queries.


  • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how

  • Want a reminder to come back and check responses? Here is how to subscribe to a notification

  • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators


image.png (14.9 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @SkorMMSC-3492,

Just checking in to see if the above answer helped. If this answers your query, do click Accept Answer and Up-Vote for the same. And, if you have any further query do let us know.

1 Vote 1 ·

Hello @PRADEEPCHEEKATLA-MSFT

thanks for the answer.

I've checked using the toscalar() function, but it is not successful as well:

 let str = toscalar(make_string(75, 117, 115, 116, 111));
 datatable (Input: string) [
     str
 ]

In this case, the str variable is scalar, but the same error message occurs...

Please loot, the the following examples:

 datatable (Input: datetime) [
     datetime(2022,04,12)
 ]

 datatable (Input: datetime) [
     make_datetime(2022,04,12)
 ]

The first command works, but the second does not. Please note, the documentation of make-datetime. There is a note:

Creates a datetime scalar value from the specified date and time.

The make-datetime() function is listed on the scalar functions as well, so the input condition for datatable scope is met.

So, I am a bit confused and have some doubts regarding restrictions for scalar values and datatable scope.

0 Votes 0 ·

Hello @SkorMMSC-3492,

datatable operator does not perform any evaluations (e.g., function calls). Potential solution is to have a static table with test content for comparison.

You may try the below workaround:

   datatable (Input: dynamic) [
        
      dynamic([75, 117, 115, 116, 111])
        
      ]
        
      | extend Input = make_string(Input)
1 Vote 1 ·