Forum Discussion
Power Query Syntax
- 2 years ago
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]
- AlexisOlson2 years agoSuper User
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.
- AMZ2 years agoRegular Visitor
Thanks ! It works.