Created
July 9, 2020 00:52
-
-
Save ninmonkey/ac528ee503b7861c9535b4961aac1107 to your computer and use it in GitHub Desktop.
replacing one column in one record of a table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// replace bad name | |
let | |
/* ignore this chunk */ | |
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSspPUtJRMgRiI0NjQxMTpVidaKW0otQUkAgQGxsZm5iZGUPEczOLizPz0kHCQGxibGRqZgSVgphjAtJlbGKqFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [name = _t, customer = _t, UID = _t]), | |
#"Changed Type" = Table.TransformColumnTypes( | |
Source,{ | |
{"name", type text}, {"customer", Int64.Type}, {"UID", Int64.Type} | |
}), | |
/* select record, modify it, then call Replace | |
you could use: https://docs.microsoft.com/en-us/powerquery-m/table-replacevalue | |
*/ | |
TargetRecord = Source{2}, // it is: [name="missing", customer=3, UID=43256234], | |
NewRecord = [name="Terry", customer=3, UID=43256234], | |
ModifiedTable = Table.ReplaceMatchingRows( | |
Source, | |
{ | |
{TargetRecord, NewRecord} | |
} | |
) | |
in | |
ModifiedTable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment