Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Allow for multiple let in statements #204

Open
FireFighter1017 opened this issue Aug 17, 2023 · 1 comment
Open

[Enhancement] Allow for multiple let in statements #204

FireFighter1017 opened this issue Aug 17, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@FireFighter1017
Copy link

Is your feature request related to a problem? Please describe.
When using copy/paste of queries from a Dataflow editor or Power Query editor (select all queries, then ctrl-c, then go in vscode and paste the code) it always report problems for queries referring to other queries in the same clipboard content.
I use this for making mass changes to queries of a same model/dataflow and/or search through code for a particular token.

Describe the solution you'd like
It would be nice if we could copy/paste queries and that either it formats the code so that VSCode can recognize query names and stop reporting problems in referencing queries .

Describe alternatives you've considered
I have tried using the command powerquery.extractDataflowDocument for Dataflows, but requires that I export the dataflow into a JSON file first and most of the time I'd like to be able to copy/paste, back and forth, while editing the Dataflow.
And this method does not apply to pbix Datasets.
All that being said, if Power Query editors would let us do find and replace through code, I wouldn't need VS Code at all.

Additional context
Here is an example of a script file I copy/pasted from a copy/paste from a dataflow:

// WS_DATA_CONVERSION
"some-dataflow-id" meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = type text]

// DF_PM_1_EXTRACT
"some-dataflow-id" meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = type text]

// DF_EQUIP
"some-dataflow-id" meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = type any]

// task-id-generator
let
    Source = PowerBI.Dataflows(),
    Workspace = Source{[workspaceId=WS_DATA_CONVERSION]}[Data],
    Dataflow = Workspace{[dataflowId=DF_PM_1_EXTRACT]}[Data],
    Entity = Dataflow{[entity="task-id-generator"]}[Data]
in
    Entity

// EQ/FLOC/ASSY - Cleaned
let
    Source = PowerBI.Dataflows(),
    Workspace = Source{[workspaceId=WS_DATA_CONVERSION]}[Data],
    Dataflow = Workspace{[dataflowId=DF_EQUIP]}[Data],
    Entity = Dataflow{[entity="EQ/FLOC/ASSY - Cleaned"]}[Data]
in
    Entity

The query names are in comments and there is no separation character like ';' between queries which could make it difficult for the language parser to recognize.
Though somehow, when pasting this same clipboard content into a Power Query editor the editor recognizes the query names. Even folders are recognized (which are not pasted when pasting the clipboard contents into a text editor for some reason...)

@bgribaudo
Copy link

Would a quick action 'convert query past -> section document' help here?

(Aside: It would be really neat if Query Editor [desktop] and Power Query Online offered a view/edit section document dialog, where the user could copy out the entire section document and/or paste an edited one back in.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants