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 · 2 comments
Open

[Enhancement] Allow for multiple let in statements #204

FireFighter1017 opened this issue Aug 17, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

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.)

@mattmasson mattmasson added help wanted Extra attention is needed good first issue Good for newcomers labels Jan 13, 2025
@mattmasson
Copy link
Member

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

Yes, I can see that being a helpful feature and pretty straightforward for someone to implement.

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.

To me, this stands out as the key point / actual feature people are looking for. I know it's something we've been wanting to do, but I'm not sure where it lands on our overall backlog.

offered a view/edit section document dialog

In Desktop, you can go to Help | About | Copy session diagnostics to clipboard to get a copy of the section document.

In Power Query Online, I believe exporting the Dataflow.json is currently the only way to see the full section document. However, the Git integration work for Dataflows Gen2 will also sync out the full section document (in a separate file, so it is not json encoded/escaped).

In the past we've viewed editing of the section document as high risk, as a corrupted/invalid document can break the PQ UI. I think it's doable with the right checks/validation but would always remain an advanced "use at your own risk" type of feature. Exposing specific UX to support find/replace and other refactoring operations that work across the dataflow might be a safer for most users. Maybe advanced users will be happy with using the git integration to edit their section documents in VS Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants