cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PA_NewUser
Regular Visitor

Adding Dynamic Gallery Controls

Hello everyone,

 

Our App has a Survey type of layout where Questions are stored in a SP list and corresponding Answers are stored in another. I want to display  Questions via a Gallery and get the answers back by dynamically showing the controls. For instance, add a DatePicker, Add Media, Radio Button and Text Label on top of each other and group them and then under the Visible property show the corresponding control based on the question Type. So, in the Visible property, I will add an expression to check the question type and if it is Bool, use Radio button etc.

 

Now, I am having an issue with the pictures. When I have more than 1 image captured via the Add Media button, how do I loop though the uploaded images and upload them to a Sharepoint Doc library? I was thinking to get the SP link back and use it for the image questions.

 

Any suggestions please?

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @PA_NewUser ,

Do you want to loop the uploaded image data from your canvas app back to your SP Library?

 

Based on the needs that you mentioned, I afraid that PowerApps could not achieve your needs. Currently, there is no direct way to upload picture file from canvas app to SP Library.

As an alternative solution, I think the combination of Power Apps and Power Automate flow could achieve your needs. I assume that you list all your question records in a Gallery, and each question has a QuestionID.

Within your canvas app, you need to collect these captured images into a collection along with Picture name, and QuestionID. Then convert the collection table as a JSON String, then pass the JSON String to your flow. Within your Power Automate flow, convert the passed JSON String into a actual JSON table using json expression, then apply a "Apply to each" action to this converted JSON Table, within the "Apply to each" action, you could add a "Create file" action of SharePoint connector to create file based on the passed JSON string.

 

Within your canvas app, you could collect your image collection as below:

11.JPG

On your side, you may type the following formula:

Collect(
        colPic, 
        {
          PicContent: Substitute(JSON(UploadedImage1.Image, JSONFormat.IncludeBinaryData), """", ""),      
          PicName: ThisItem.QuestionID & "_" & AddMediaButton1.FileName
        }
)

 

When you want to pass the colPic collection back to your flow, you need to try the following formula:

'Flow Name'.Run(JSON(colPic, JSONFormat.IncludeBinaryData))

 

Your flow's configuration may look like below:

12.JPG

 

 

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

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

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

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

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
PA_NewUser
Regular Visitor

Attached is the layout of the app to get an idea..

v-xida-msft
Community Support
Community Support

Hi @PA_NewUser ,

Do you want to loop the uploaded image data from your canvas app back to your SP Library?

 

Based on the needs that you mentioned, I afraid that PowerApps could not achieve your needs. Currently, there is no direct way to upload picture file from canvas app to SP Library.

As an alternative solution, I think the combination of Power Apps and Power Automate flow could achieve your needs. I assume that you list all your question records in a Gallery, and each question has a QuestionID.

Within your canvas app, you need to collect these captured images into a collection along with Picture name, and QuestionID. Then convert the collection table as a JSON String, then pass the JSON String to your flow. Within your Power Automate flow, convert the passed JSON String into a actual JSON table using json expression, then apply a "Apply to each" action to this converted JSON Table, within the "Apply to each" action, you could add a "Create file" action of SharePoint connector to create file based on the passed JSON string.

 

Within your canvas app, you could collect your image collection as below:

11.JPG

On your side, you may type the following formula:

Collect(
        colPic, 
        {
          PicContent: Substitute(JSON(UploadedImage1.Image, JSONFormat.IncludeBinaryData), """", ""),      
          PicName: ThisItem.QuestionID & "_" & AddMediaButton1.FileName
        }
)

 

When you want to pass the colPic collection back to your flow, you need to try the following formula:

'Flow Name'.Run(JSON(colPic, JSONFormat.IncludeBinaryData))

 

Your flow's configuration may look like below:

12.JPG

 

 

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

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

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

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

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Worked like charm. Thanks for the super quick reply.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (41,545)