Forum Discussion
Aarohi Chowdary
Jul 08, 2018Copper Contributor
Accessing a column from within toscalar() - Log Analytics Query Language
Speaking in terms of C, I need to do something like this:
for(i = 0; i < 30; i++)
subquery(i);
The subquery returns a table with a single cell. I am trying to do something like this:
range offset from 1 to 30 step 1
| project Column = toscalar( range index from 1 to 30 step 1 | where index == offset)
But the offset in the toscalar() is not being recognized; I'm getting the following error: 'where' operator: Failed to resolve column or scalar expression named 'offset'. Is there an alternative to what I'm trying to do? Thanks in advance 🙂
PS: The sub-query in the toscalar() is actually the output of a very huge table; used range only for demonstration purpose.
- Noa Kuperberg
Microsoft
not sure what you are trying to do, exactly.
in the given example, the input to the where clause is: "range index from 1 to 30 step 1", so the where clause can only recognize one column, named "index".
Can you explain a bit more what you want to do? is the repeating of subquery related to the index of each row?
- Aarohi ChowdaryCopper ContributorI am trying to run the sub-query for each value of the range 1 to 30, and the sub-query results in a single cell table. The sub-query needs to have access to the current value from the range, but it isn't being recognized inside toscalar()