Skip to content

Commit 2b7e0d3

Browse files
committed
Update DebugUtils.module.pq
1 parent b3115f4 commit 2b7e0d3

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

source-modules/DebugUtils.module.pq

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[
22
/*
3+
Created: 2024-06-04
34
About:
45
If you're trying to quickly experiment with queries in interactive mode
5-
Then this module gives you short aliases as shorthand
6+
Then this module gives you alias as shorthand for functions that are useful for debugging
67

7-
this should be a self contained file
8+
Should run without any external functions or dependencies
89
*/
910

1011
// aliases mainly for interactive use when debugging
@@ -29,6 +30,9 @@
2930
Source = source
3031
],
3132

33+
// get an abstract syntax tree
34+
Ast = (source as any) as nullable record => Value.Expression( source ),
35+
3236
// always case-insensitive
3337
Text.Contains.CI = ( source as nullable text, substring as text) as nullable logical =>
3438
Text.Contains( source, substring, Comparer.OrdinalIgnoreCase ),
@@ -40,6 +44,11 @@
4044
// stop folding without forcing buffer or index column enumerations
4145
StopFold = (source as table) as table => Table.StopFolding(source),
4246

47+
// see: https://blog.crossjoin.co.uk/2023/12/10/getting-different-versions-of-data-with-value-versions-in-power-query/
48+
Versions = (value as any) as table => Value.Versions( value ),
49+
// see: https://blog.crossjoin.co.uk/2023/12/10/getting-different-versions-of-data-with-value-versions-in-power-query/
50+
Versions.Which = (value as any) as any => Value.VersionIdentity( value ),
51+
4352
// IIRC this only affects evaluation when using the query editor. so if you have a lot of sketches, this may help there. YMMV
4453
TableDelayedBuffer = (source as table) as table =>
4554
Table.Buffer(source, [ BufferMode = BufferMode.Delayed ] ),

0 commit comments

Comments
 (0)