Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Using Images from a Database in Power BI - YouTube
Hello,
The above code retrieves certain columns from a table, one of which is a column containing images in binary content. The code transforms the images into text readable and understandable by Power BI and returns a table. However, when I try to execute it, I get an error that I don't understand. The Power Query editor asks me to put a parenthesis in place of the comma. I've tried, but it doesn't work. I don't understand why.
I've also attached, below the image, the link to the video from which I took the code.
Maybe the Power Query M language syntax has changed, because the video I saw is 3 years old.
Thanks in advance !
Solved! Go to Solution.
Ah, that's probably be the InputRow(xxx) parts. Try InputRow{xxx} instead since the parentheses make it think it's a function with an argument instead of an element from a list.
That particular error doesn't make sense to me. The only issue I see at first glance is that you have
CreatedDate = InputRow(InputCreateddatePosition)
instead of
CreatedDate = InputRow(InputCreatedDatePosition)
I don't get any errors with this code:
let
//Entrée des paramètres fournis pour invoquer la fonction
photoResult = (InputTable as table, InputBinaryPosition as number, InputNamePosition as number, InputCreatedDatePosition as number) as table =>
let
//Obtention des Listes d'images de la base de données
Source = (InputTable),
//Conversion de la table qui contient les images en liste
ListToInput = Table.ToRows(Source),
//Création de la fonction splitter
SplitTextFunction = Splitter.SplitTextByRepeatedLengths(30000),
//Conversion du contenu binaire en text et création d'images entrecoupées en 30000 lignes
ConvertOneFile = (InputRow as list) =>
let
Binary = InputRow(InputBinaryPosition),
Name = InputRow(InputNamePosition),
CreatedDate = InputRow(InputCreatedDatePosition),
BinaryText = Binary.ToText(Binary, BinaryEncoding.Base64),
SplitUpText = SplitTextFunction(BinaryText),
AddFileName = List.Transform(SplitUpText, each {Name, CreatedDate, _})
in
AddFileName,
//Passage en revue de toutes les photos et appel de la fonction ci-haute
ConvertsAllRows = List.Transform(ListToInput, each ConvertOneFile(_)),
//Combinaison des listes ensemble
CombineLists = List.Combine(ConvertsAllRows),
//Conversion du résultat en table
ToTable = #table(type table [Name = text, CreatedDate = date, PhotoNonConformité = text], CombineLists),
//Ajout de la colonne index à la table obtenue
AddIndexColumn = Table.AddIndexColumn(ToTable, "Index", 0, 1)
in
AddIndexColumn
in
photoResult
Thanks, it works. But when the function runs, I get the error below.
An error occurred in the "GetTheEntireImage" request. Expression.Error : Sorry... We were unable to convert a List value to a Function value.
Details:
Value=[List]
Type=[Type]
Ah, that's probably be the InputRow(xxx) parts. Try InputRow{xxx} instead since the parentheses make it think it's a function with an argument instead of an element from a list.
Thanks ! It works.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 7 | |
| 7 | |
| 6 |