stored_query_result()

Learn how to use the stored_query_result() function to reference a stored query result.

Retrieves a previously created stored query result.

To set a stored query result, see .set stored_query_result command.

Syntax

stored_query_result( StoredQueryResultName )

Parameters

NameTypeRequiredDescription
StoredQueryResultNamestring✔️The name of the stored query result.

Examples

References the stored query result named Numbers.

stored_query_result("Numbers")

Output

X
1
2
3

Pagination

The following example retrieves clicks by Ad network and day, for the last seven days:

.set stored_query_result DailyClicksByAdNetwork7Days with (previewCount = 100) <|
Events
| where Timestamp > ago(7d)
| where EventType == 'click'
| summarize Count=count() by Day=bin(Timestamp, 1d), AdNetwork
| order by Count desc
| project Num=row_number(), Day, AdNetwork, Count

Output

NumDayAdNetworkCount
12020-01-01 00:00:00.0000000NeoAds1002
22020-01-01 00:00:00.0000000HighHorizons543
32020-01-01 00:00:00.0000000PieAds379

Retrieve the next page:

stored_query_result("DailyClicksByAdNetwork7Days")
| where Num between(100 .. 200)

Output

NumDayAdNetworkCount
1002020-01-01 00:00:00.0000000CoolAds301
1012020-01-01 00:00:00.0000000DreamAds254
1022020-01-02 00:00:00.0000000SuperAds123