web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Image variable not wor...
Power Apps
Answered

Image variable not working when Patching a collection

(0) ShareShare
ReportReport
Posted on by 380

Hello everybody!!

I have an issue that is driving me crazy...

I need to populate a word in power automate... https://powerusers.microsoft.com/t5/Building-Flows/Populating-word-from-2-different-Apply-to-Each/m-p/1968417 this is my first post related to power automate.

To put it all into a comprehensible context. I need to populate a report (I have premium connector for word populating templates) and I am trying to add some signatures. I have worked uploading images before and I have many reports that are working perfectly.. but this one is driving me insane.

 

What I did first (my original problem) was getting my flow triggered from PowerApps and it sent a json collection to power automate with the signatures (name: colFirmas, and they are so many!!).

Let me explain.

Fernanda_0-1674244724454.png

 

Here are my 3 signatures per document. I need to get one document per count (each chemical per warehouse), that would make at least 50 documents, each with 3 signatures, so, those signatures change in every document. (a lot of signatures).

 

Since I haven't got any help with it, I have been looking for a workaround, and I thought I should try making only one collection directly from PowerApps, instead of trying to match a collection and SP List that I couldn't get to work.

 

So, I went back to my App and changed some formulas. I must add that my collection must work offline, so everything is built around collections. 

 

To begin with, my original main database is imported as a collection (colBaseSP), now I have added 9 columns with the info I need for the signatures and that are not part of my SP List and they must not be uploaded to the SP list, only to my power automate (this wasn't in my original design... it was just collecting my SP List, no columns added)

 

ClearCollect(
 colBaseSP; 
 AddColumns(Filter(
 'Inventario Quimicos parte 1';
 Dd_ZonaInventario.SelectedText.Value = 'Nombre Inventario'.Value
 );"Base Firma Operador";"";"Nombre Foto Operador";"";"Firmante Operador";"";"Base Firma Encargado";"";"Nombre Foto Encargado";"";"Firmante Encargado";"";"Base Firma Jefe";"";"Nombre Foto Jefe";"";"Firmante Jefe";"")

So, this is my main collection.

 

When a signature is created, this happens

Set(varNombreFirma;
If(IsBlankOrError(LookUp(colNomina; Radio1.Selected.Value=Rol).Nombre);TextInput3.Text;LookUp(colNomina; Radio1.Selected.Value=Rol).Nombre) & "-" &varPlanta & "-" & VarQuimico
)
;;
Collect(colFirmas; 
{
 DisplayName: varNombreFirma & ".jpg";
 ID: 1+Last(colFirmas).ID;
 Apress: Pen_Firmas.Image;
 Timestamp: Now();
 Planta: varPlanta;
 Firmante: If(IsBlankOrError(LookUp(colNomina; Radio1.Selected.Value=Rol).Nombre);TextInput3.Text;LookUp(colNomina; Radio1.Selected.Value=Rol).Nombre);
 Tipo: "Conteo";
 Quimico: VarQuimico;
 'Codigo Quimico':LookUp(colBaseSP;VarQuimico='NOMBRE MATERIAL').'CÓDIGO MATERIAL';
 Cargo: If(IsBlankOrError(LookUp(colNomina; Radio1.Selected.Value=Rol).Rol);"Operador Planta";LookUp(colNomina; Radio1.Selected.Value=Rol).Rol)
} );;Collect(colFirmaRapida; 
{
 DisplayName: varNombreFirma & ".jpg";
 ID: 1+Last(colFirmas).ID;
 Apress: Pen_Firmas.Image;
 Timestamp: Now();
 Planta: varPlanta;
 Firmante: If(IsBlankOrError(LookUp(colNomina; Radio1.Selected.Value=Rol).Nombre);TextInput3.Text;LookUp(colNomina; Radio1.Selected.Value=Rol).Nombre);
 Tipo: "Conteo";
 Quimico: VarQuimico;
 Cargo: If(IsBlankOrError(LookUp(colNomina; Radio1.Selected.Value=Rol).Rol);"Operador Planta";LookUp(colNomina; Radio1.Selected.Value=Rol).Rol);
 'Codigo Quimico':LookUp(colBaseSP;VarQuimico='NOMBRE MATERIAL').'CÓDIGO MATERIAL'
} )

;;
Set(varCargo;If(IsBlankOrError(LookUp(colNomina; Radio1.Selected.Value=Rol).Rol);"Operador Planta";LookUp(colNomina; Radio1.Selected.Value=Rol).Rol));;Set(varFirmante;If(IsBlankOrError(LookUp(colNomina; Radio1.Selected.Value=Rol).Nombre);TextInput3.Text;LookUp(colNomina; Radio1.Selected.Value=Rol).Nombre));;Set(varArchivoFoto;varNombreFirma & ".jpg");;Set(varApressTemporal;Pen_Firmas.Image);;

 
 If(varCargo="Operador Planta";
Patch(colBaseSP; LookUp(colBaseSP;PLANTA=varPlanta && 'NOMBRE MATERIAL'=VarQuimico);{'Nombre Foto Operador': varArchivoFoto;'Firmante Operador':varFirmante;'Base Firma Operador':varApressTemporal});If(varCargo="Encargado Bodega";Patch(colBaseSP; LookUp(colBaseSP;PLANTA=varPlanta && 'NOMBRE MATERIAL'=VarQuimico);{'Nombre Foto Encargado':varArchivoFoto;'Firmante Encargado':varFirmante;'Base Firma Encargado':varApressTemporal});Patch(colBaseSP; LookUp(colBaseSP;PLANTA=varPlanta && 'NOMBRE MATERIAL'=VarQuimico);{'Nombre Foto Jefe':varArchivoFoto;'Firmante Jefe':varFirmante;'Base Firma Jefe':varApressTemporal})))


;;
SaveData(colFirmas;"ColeccionFirmas");;SaveData(colFirmaRapida;"ColFirmaRapida");;


Reset(Pen_Firmas);;Reset(Radio1);;Reset(TextInput3);;Notify("Firma agregada";Success)

Originally, I didn't use any of the last variables (varCargo, varFirmante, varArchivoFirma, varApressTemporal), but since I needed to identify whenever one of those 3 people signed and save the data accordingly to each role, that was the only way I could think of... and it is working, it is patching the correct columns when each of them signs.

My variable gets created

Fernanda_1-1674245402624.png

colFirmas gets populated correctly

Fernanda_2-1674245474194.png

but the patch function... shows me the appres text.

Fernanda_3-1674245523113.png

And this is a major problem for me. Since this is an offline app, I must store all data to later convert it, apply JSON function and send it to power automate.

This is the patch I had started building to create my final collection (this is only the image columns... my colBaseSP has like 20 columns, all of them text expect for these ones):

ForAll(
 colBaseSP;
 Collect(
 colFullDatos;
 {
 'Base Firma Operador': Mid(
 JSON(
 ThisRecord.'Base Firma Operador';
 JSONFormat.IncludeBinaryData
 );
 Find(
 ",";
 JSON(
 ThisRecord.'Base Firma Operador';
 JSONFormat.IncludeBinaryData
 )
 ) + 1;
 Len(
 JSON(
 ThisRecord.'Base Firma Operador';
 JSONFormat.IncludeBinaryData
 )
 ) - Find(
 ",";
 JSON(
 ThisRecord.'Base Firma Operador';
 JSONFormat.IncludeBinaryData
 )
 ) - 1
 );
 'Base Firma Encargado': Mid(
 JSON(
 ThisRecord.'Base Firma Encargado';
 JSONFormat.IncludeBinaryData
 );
 Find(
 ",";
 JSON(
 ThisRecord.'Base Firma Encargado';
 JSONFormat.IncludeBinaryData
 )
 ) + 1;
 Len(
 JSON(
 ThisRecord.'Base Firma Encargado';
 JSONFormat.IncludeBinaryData
 )
 ) - Find(
 ",";
 JSON(
 ThisRecord.'Base Firma Encargado';
 JSONFormat.IncludeBinaryData
 )
 ) - 1
 );
 'Base Firma Jefe': Mid(
 JSON(
 ThisRecord.'Base Firma Jefe';
 JSONFormat.IncludeBinaryData
 );
 Find(
 ",";
 JSON(
 ThisRecord.'Base Firma Jefe';
 JSONFormat.IncludeBinaryData
 )
 ) + 1;
 Len(
 JSON(
 ThisRecord.'Base Firma Jefe';
 JSONFormat.IncludeBinaryData
 )
 ) - Find(
 ",";
 JSON(
 ThisRecord.'Base Firma Jefe';
 JSONFormat.IncludeBinaryData
 )
 ) - 1
 )
 }
 )
)

so... finally, this last collection colFullDatos is the one I was going to send to a new flow and finally get the report I need.

 

But... since the variable is not working when patching colBaseSP, none of the rest works and of course, no report.... what can I do??? I didn't know I couldn't patch an image variable... maybe it can be done, and I am doing all wrong... I have no idea... but I have been trying to find a way for a while now and it is really driving me crazy...

 

Can you help me?? do you have any other approachs that I can try??? this is like my 5th attempt of rebuilding the whole thing and finding a different way... but totally helpless...

Thank you so much in advance!!!

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,576 Most Valuable Professional on at

    Hi @Fernanda ,

    I will give you a start here - the fundamental issue is what you have identified - the "image" you are collecting is simply pointing at the internal "appres" reference, which will disappear when the app is closed. I suggest you do this

    Collect(
    colFirmas; 
     {
     DisplayName: varNombreFirma & ".jpg";
     ID: 1+Last(colFirmas).ID;
     Apress: With(
     {wJSON: JSON(Pen_Firmas.Image.Image, JSONFormat.IncludeBinaryData)};
     Mid(
     wJSON;
     Find( ","; wJSON) + 1;
     Len(wJSON) - Find(","; wJSON) - 1
     )
     );
     Timestamp: Now();
     . . . . . . . . .
     } 
    )

    and send that to the second collection and subsequently the offline file.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Fernanda Profile Picture
    380 on at

    Thank you Warren!! I will give this a try

    Question.. I was avoiding the json function at this point, because there will be so many files, my apps goes very slow, so I was waiting until the very last moment before parsing.

    With your idea, can I still avoid having it running slow??? I will have at least 150 signatures. And in another colection, 300 photos.... i made it work fine by avoiding the json until the very last moment (i would parse right before running my flow for the photo library... same as the signatures)

  • Fernanda Profile Picture
    380 on at

    Hi Warren!!

    Thank you! I tested it and it worked!!

    I will still have to test it with real data due to the amount of signatures I need to process (with photos, it got very slow after a while, so we worked around that issue).

    But so far.... super awesome!!

    Thank you so much for all of your help!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard