Forum Discussion
Check if query exists
Hi ImkeF,
Those queries are created by calling one function several times. Some are then deleted. You may therefore end up with a list of queries looking like this :
- "Invoked Function (2)"
- "Invoked Function (4)"
- "Invoked Function (7)"
I'm trying to loop through a range (say 1 to 10), identify the existing corresponding queries (2, 4, 7 in this case), and append them to a general table. "try ... otherwise" is part of the answer, but i'm missing a way to loop through all the potential query names and check if the corresponding table exist.
The general purpose of this is to append a new row to my observations table from a powerquery form (the invoked function). Maybe there's a better way to do that ?
Hi AntoineCh,
this will return a list of all queries in your file that start with "Invoked":
List.Select(Record.FieldNames(#shared), each Text.Start(_, 7)="Invoked")
You can use this directly like this:
Table.Combine(List.Select(Record.FieldNames(#shared), each Text.Start(_, 7)="Invoked"))
Is is important that the names of your queries don't start with a text-string that is also part of the existing functions (who will be part of #shared). Using "Invoked" will be suitable.
So you're disabling "Refresh on Report Refresh" on all these queries?
Will publish a blogpost over the weekend with an alternative approach, which might suit you as well.