Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Tengo una columna con enlaces en ella, necesito decodificarlo. Los enlaces están codificados, en %s como se muestra a continuación
Por ejemplo: https%3A%2F%2Fwww.rnd.de%2Fpanorama%2Ftwo-aircraft-shocks-in-munsterland-together-both-pilots-tot-YDHGMRPATRCUBC6SCDD27TSQRU.html
debe ser decodificado para
https://www.rnd.de/panorama/zwei-flugzeuge-stossen-im-munsterland-zusammen-beide-piloten-tot-YDHGMRP...
Encontré una solución aquí:
https://stackoverflow.com/questions/36242695/how-to-decodeuricomponent-ex-2f3f263d
Pero soy muy nuevo en el código M, así que no sé dónde me voy mal. Pero me da este error
Este es el código que he escrito
Dejar
InputData - Excel.Workbook(File.Contents("C:-Usuarios-Fatima-Descargas-Microsoft.SkypeApp_kzf8qxf38zg5c! App-All-codificado-URL.xlsx"), null, true),
Uri.UnescapeDataString (datos como texto) como texto > let
ToList : Text.ToList(data),
Acumular - List.Accumulate(ToList, [ Bytes ? ], (estado, actual) >
Dejar
HexString - estado[HexString]?,
NextHexString - HexString & current,
NextState - if HexString <> null
entonces si Text.Length(NextHexString) á 2
entonces [ Bytes state[Bytes] & Binary.ToList(Binary.FromText(NextHexString, BinaryEncoding.Hex)) ]
else [ HexString á NextHexString, Bytes - estado[Bytes] ]
si actual es "%"
entonces [ HexString á "", Bytes - estado[Bytes] ]
else [ Bytes á estado [Bytes] & ? Character.ToNumber(current) ? ]
En
NextState),
FromBinary á Text.FromBinary(Binary.FromList(Accumulate[Bytes]))
En
FromBinary,
AddEscaped á Table.AddColumn(InputData, "Escaped", cada Uri.EscapeDataString([Column1])),
AddUnescaped á Table.AddColumn(AddEscaped, "Custom", each Uri.UnescapeDataString([Escaped]))
En
AddUnescaped
¿Alguien puede decirme dónde me voy mal?
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
No olvides que siempre existe el método de fuerza bruta. Después de todo, no hay muchos caracteres codificados en la mayoría de las direcciones URL.
Puede extender lo siguiente para cubrir también ? y y espacio.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("DYjLCsIwEAD/pdDj5lBBz7VFvQjax0FKD5GsbSCbhGZDIF9vYA4zsyzVzuxDfWrr5lZIKYnDKqGwhJfWHZJk0ZxQw8/ELWPcEAK7ENCCJqBoA+NhpFWQY5BE5X9RKwSvjeNS7Bg+/eP+HF7tNHTztTuPXd83l2l8D7PYmUy1rn8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Replaced Value" = Table.ReplaceValue(Source,"%3A",":",Replacer.ReplaceText,{"Column1"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","%2F","/",Replacer.ReplaceText,{"Column1"})
in
#"Replaced Value1"
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.