How can I add a custom row to the end of my query results

843 views Asked by At

I have a simple query for reporting.

requests
| project name

which gives me:

name
----
foo
bar
baz

I want to modify the query to add an extra row, so something like:

requests
| project name
| print("qux")

which would give:

name
----
foo
bar
baz
qux

Is this possible? I can't just add actual data, and the real reason is for reporting purposes. I just need to write a query that will give me the last results I listed above.

1

There are 1 answers

0
Assaf Neufeld On

You can create a custom table with the row you want using 'datatable', and then use the 'union' operator to append the row:

let x = datatable (name:string) [ "qux" ];
requests
| take 5
| project name 
| union x

Also possible to start with a 'print':

print("qux")
| project-rename name=print_0
| union (requests | take 5 | project name)