Forum Discussion
edhans
6 years agoCommunity Champion
Understanding Expression.Evaluate - isn't working
I have the following M code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtJR8krMUzAyMDJQitUB88G0Z0lqLpAdnJiTWgwWSATyDMGsJCDLCMxKBrKMlWJjAQ==", Bin...
- 6 years ago
When you use Expression.Evaulate you need to include every variable and library function you want to make avialable in a record. In your case:
Expression.Evaulte(#"Need Help", [Long Step Name = #"Long Step Name"])
lbendlin
6 years agoSuper User
I think you're just holding it wrong. Here's how far I got for now.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtJR8krMUzAyMDJQitUB88G0Z0lqLpAdnJiTWgwWSATyDMGsJCDLCMxKBrKMlWJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
#"Long Step Name" = Source,
#"Added Custom" = Table.AddColumn(#"Long Step Name", "Custom", each List.PositionOf(Table.Column(#"Long Step Name","Column1"),"Item"))
in
#"Added Custom"
please ignore the custom column, that's just for debugging.
The next step would be
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtJR8krMUzAyMDJQitUB88G0Z0lqLpAdnJiTWgwWSATyDMGsJCDLCMxKBrKMlWJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
#"Long Step Name" = Source,
ToSkip = List.PositionOf(Table.Column(#"Long Step Name","Column1"),"Item"),
#"Removed Top Rows" = Table.Skip(#"Long Step Name",ToSkip),
#"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Sales", Currency.Type}})
in
#"Changed Type"