Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AMZ
Regular Visitor

Power Query Syntax

Capture31.JPG

 

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 !

1 ACCEPTED 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.

View solution in original post

4 REPLIES 4
AlexisOlson
Super User
Super User

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.

Capture32.JPG

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.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors