Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How do I have a query reference itself from a previous step (but I don't want to create a new query)

I have a query that has multiple steps (e.g., steps 1, 2, 3, 4, etc). I want at step 4 of the query to reference step 2 of the query (I'm doing this because I need to do a grouping).   How can I ha...
  • Mariusz's avatar
    6 years ago

    Hi Anonymous 

     

    If you reference the previous step or even query there is a chance it will run the code twice anyway as steps are not loaded or stored anywhere during the execution process or else you use Table.Buffer or List.Buffer function. If you want to avoid expecting the same query twice, you can watch this video it might help you.

    https://www.youtube.com/watch?v=3uKNNZqBIkg&t=764s

     

    If this is not the answers to your requirement you can try explaining your scenario in more detailed.

     

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn

     

  • mahoneypat's avatar
    6 years ago

    To reference an earlier step, just right click on your last step and choose "Insert Step After".  Then, in the formula bar type in 

     

    = #"Changed Type"  (or whatever the earlier step is named)

     

    Good practice is to rename your steps so they are more meaningful especially when you start jumping around the query.  Also good to rename with no spaces so you don't have to worry about all the #"  "s.

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat