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 / Attachments and SQL
Power Apps
Unanswered

Attachments and SQL

(0) ShareShare
ReportReport
Posted on by 1,142

Thank you for taking the time to read my question.

 

I found this great video by Shane Young: https://www.youtube.com/watch?v=Pa-pYEkLH-U

 

I'm wondering if it's possible to do this with SQL also instead of Azure. If so how... I'm not even sure what to search for.

 

Thanks

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Anything is possible in the Power Platform! Is your SQL Server On-Premises? If so, do you have an On-Premise Data gateway for your SQL server?

    Also, this will require the help of Power Automate. How comfortable are you with Power Automate?

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    HI @iwonder ,

    Do you want to use the Attachments control to attach multiple files, and then save them back to your SQL Server Table?

     

    Regarding the needs that you mentioned, I think the Attachments control could achieve your needs. Firstly, you need to add a varchar(max) type column in your SQL Table to store the binary format data of these uploaded files in your Attachments.

     

    Please check and see if the following video resource could help in your scenario:

    https://www.youtube.com/watch?v=kQVYid1p_vA

    https://www.youtube.com/watch?v=UYK7yruBHDM

     

    If you just want upload image files from your canvas app into your SQL Table, I think it is not necessary to set up a Power Automate flow to help you achieve your needs along with the canvas app. You just need to save these images files attached in the Attachments control into a collection, then add a Gallery control in your app to display these image data stored in this collection using Image control. After that, you could use the JSON function to convert the image blob data into a actual base64 encoded data, then use the Patch function to save the base64 encoded data back to your SQL Table.

    You may need to use the following formula to save your Gallery image data back to your SQL Table:

    ForAll(
     ImageGallery.AllItems,
     Patch(
     '[dbo].[SQLTable]', 
     Defaults('[dbo].[SQLTable]'),
     {
     ImageColumn: Substitute(JSON(Image1.Image, JSONFormat.IncludeBinaryData), """", ""),
     ...
     ...
     }
     )
    )

    Note: The ImageColumn represents the varchar(max) type column in your SQL Table.

     

    Also please check if the following video resource could help in your scenario:

    https://www.youtube.com/watch?v=QnDD7jleHME

     

    Regards,

  • iwonder Profile Picture
    1,142 on at

    Hi to both of you. Thank you very much for your replies. Sorry for my slow reply I had a few days off.

     

    I will look into both of your ideas over the next few days.

     

    My end goal is: To have sales people collect customer feedback and have the ability to collect attachments. Then submit the collected data and any attachments. We have a custom application that the office staff use to process the customer feedback. They can also open and review any attachments. Today the attachments are stored in a folder on the server, not directly in the database. If I store the attachments in the database can we still open the attachments or do they have to be stored on the server and the path to the file(s) stored in the db?

     

    Thank again, I really appreciate your help and time.

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @iwonder ,

    Could you please share a bit more about these attachments? Are they all Image files?

     

    If these Attachments that you mentioned are all images files, I think above solution I provided above could achieve your needs without any issue. And you could also review these stored image files in your canvas app directly.

     

    If these attachments are any files (e.g. Image files, PDF files, Doc files, ...), I afraid that above solution may not achieve your needs. I agree with your thought almost, you need to store your attachments files in a cloud storage, e.g. SP Library folder, CDS Entity, ... etc.

     

    As an alternative solution, you could consider use SP List or CDS Entity as your data source, then you could store your attachments files into a SP List or CDS Entity. The Attachments control is supported in SP List and CDS Entity primitively.

     

    Regards,

  • iwonder Profile Picture
    1,142 on at

    HI @v-xida-msft 

     

    Thanks again for your reply and help. 

     

    The attachments can vary. .doc, .pdf, xlsx, .jpg, .png, .heic.....

     

    Perhaps storing them on SharePoint is ok... I'd have to figure out how to retrieve them from SP via our custom program. More food for thought!

     

    Thanks again

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @iwonder ,

    If you want to store various files from the Attachments control, I afraid that the SQL Table may not be the best choice for your scenario. Instead, I think the SP Library would be better.

     

    You could consider store the attached files from the Attachments into your SP Library. Please check and see if the following video resource could achieve your needs:

    https://www.youtube.com/watch?v=kQVYid1p_vA

    https://www.youtube.com/watch?v=UYK7yruBHDM

     

    Regards,

  • iwonder Profile Picture
    1,142 on at

    Thank yo for the links! I will have a look and get back to you.

     

    have a great day.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 577

#2
WarrenBelz Profile Picture

WarrenBelz 440 Most Valuable Professional

#3
Haque Profile Picture

Haque 308

Last 30 days Overall leaderboard