cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Splitting an array to string - HTML table

In my flow I initialise a variable, varAttachments, which is an array. The array is made up of URLs of the file attachments from a SharePoint list item (AbsoluteURI).

I want to get all the URLs from the array into their own strings and then reference them in my HTML table.

 

So the array is in the format ["AttachmentURL1", "AttachmentURL2"] and I want "AttachmentURL1" "AttachmentURL2" each as strings. There could be any number of URLs in the array.

 

Once I have those I need to add them to a HTML table as below except that each URL string needs to be wrapped in an <img> tag. What would be the best way for me to do this please?

 

calvares_0-1616769558545.png

 

7 REPLIES 7
Anonymous
Not applicable

Just to give some more information on this. This is how I got my array:

calvares_1-1617027439562.png

 

I get my SharePoint items (odata filtered) and initialise the varAttachments variable. I get the attachments for each of my SharePoint items. I append Absolute URI to varAttachments within an apply to each (body for get attachments). 

 

I've also tried this with varAttachments as a string and it creates one string of the URLs without a separator.

Really what I need to do is separate each of my varAttachments into their own values. Am I missing something really obvious?

 

mahoneypat
Solution Sage
Solution Sage

This article shows one way to do this.

https://faustocapellan.com/2021/01/26/how-to-5-format-links-sent-via-email-in-power-automate/

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about the Power Platform, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi @mahoneypat 

Thanks for the idea. The concat is the right idea of what I need to do, but I'm working with multiple images, so it doesn't help with that.

 

I've now got the images to display in my table (in the body of the email but not the PDF) by setting a string variable, varAttachments, to be a concat of <img src wrapped around items('Apply_to_each')?['AbsoluteUri']. This variable is then just added to the HTML table. However the problem is that this brings all the images into each row, where I'd like it to display only the images applicable to each item. I need for the flow to recognise which attachments apply to which items. Is this at all possible?

rich9203
Frequent Visitor

Hi Calvares .... did you succeed with this?  I have a use case to produce a printable (ideally PDF) report of SharePoint items with attachment images displayed for each item - this could be many images for each SP list item.  Thanks Pete

Anonymous
Not applicable

Yes, I found I had to have a flow to generate the URIs when an item was created or modified then update the item in a 'URI' column. Then when creating your HTML document you just need to reference the URI column.

This is from the first flow:

calvares_0-1639498098434.png

In the append to string variable I've wrapped the uri in a <img src>:

concat('<img src="', outputs('Compose'), '"alt="images" width="100" height="100">  ')

 

Just be mindful that some of the dataURIs can be really long so first make sure the column is for multi lines of text. Secondly, it can be a bit of a memory strain on your SharePoint list if you have many items.

Hope that helps.

rich9203
Frequent Visitor

Many thanks for the update .... does this work for multiple attachments for an item?

Anonymous
Not applicable

Yes I had multiple attachments for each item so that's why I had to take this step. 

Also be aware that if you have lots of images there's a 2MB size limit on the OneDrive convert file to PDF.

I hit issue after issue with this!

Helpful resources

Announcements

Power Platform Connections - Episode 7 | March 30, 2023

Episode Seven of Power Platform Connections sees David Warner and Hugo Bernier talk to Dian Taylor, alongside the latest news, product reviews, and community blogs.     Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show.  

Announcing | Super Users - 2023 Season 1

Super Users – 2023 Season 1    We are excited to kick off the Power Users Super User Program for 2023 - Season 1.  The Power Platform Super Users have done an amazing job in keeping the Power Platform communities helpful, accurate and responsive. We would like to send these amazing folks a big THANK YOU for their efforts.      Super User Season 1 | Contributions July 1, 2022 – December 31, 2022  Super User Season 2 | Contributions January 1, 2023 – June 30, 2023    Curious what a Super User is? Super Users are especially active community members who are eager to help others with their community questions. There are 2 Super User seasons in a year, and we monitor the community for new potential Super Users at the end of each season. Super Users are recognized in the community with both a rank name and icon next to their username, and a seasonal badge on their profile.  Power Apps  Power Automate  Power Virtual Agents  Power Pages  Pstork1*  Pstork1*  Pstork1*  OliverRodrigues  BCBuizer  Expiscornovus*  Expiscornovus*  ragavanrajan  AhmedSalih  grantjenkins  renatoromao    Mira_Ghaly*  Mira_Ghaly*      Sundeep_Malik*  Sundeep_Malik*      SudeepGhatakNZ*  SudeepGhatakNZ*      StretchFredrik*  StretchFredrik*      365-Assist*  365-Assist*      cha_cha  ekarim2020      timl  Hardesh15      iAm_ManCat  annajhaveri      SebS  Rhiassuring      LaurensM  abm      TheRobRush  Ankesh_49      WiZey  lbendlin      Nogueira1306  Kaif_Siddique      victorcp  RobElliott      dpoggemann  srduval      SBax  CFernandes      Roverandom  schwibach      Akser  CraigStewart      PowerRanger  MichaelAnnis      subsguts  David_MA      EricRegnier  edgonzales      zmansuri  GeorgiosG      ChrisPiasecki  ryule      AmDev  fchopo      phipps0218  tom_riha      theapurva  takolota     Akash17  momlo     BCLS776  Shuvam-rpa     rampprakash  ScottShearer     Rusk  ChristianAbata     cchannon  Koen5     a33ik  Heartholme     AaronKnox  okeks      Matren   David_MA     Alex_10        Jeff_Thorpe        poweractivate        Ramole        DianaBirkelbach        DavidZoon        AJ_Z        PriyankaGeethik        BrianS        StalinPonnusamy        HamidBee        CNT        Anonymous_Hippo        Anchov        KeithAtherton        alaabitar        Tolu_Victor        KRider        sperry1625        IPC_ahaas      zuurg    rubin_boer   cwebb365   Dorrinda   G1124   Gabibalaban   Manan-Malhotra   jcfDaniel   WarrenBelz   Waegemma   drrickryp   GuidoPreite    If an * is at the end of a user's name this means they are a Multi Super User, in more than one community. Please note this is not the final list, as we are pending a few acceptances.  Once they are received the list will be updated. 

Register now for the Business Applications Launch Event | Tuesday, April 4, 2023

Join us for an in-depth look into the latest updates across Microsoft Dynamics 365 and Microsoft Power Platform that are helping businesses overcome their biggest challenges today.   Find out about new features, capabilities, and best practices for connecting data to deliver exceptional customer experiences, collaborating, and creating using AI-powered capabilities, driving productivity with automation—and building towards future growth with today’s leading technology.   Microsoft leaders and experts will guide you through the full 2023 release wave 1 and how these advancements will help you: Expand visibility, reduce time, and enhance creativity in your departments and teams with unified, AI-powered capabilities.Empower your employees to focus on revenue-generating tasks while automating repetitive tasks.Connect people, data, and processes across your organization with modern collaboration tools.Innovate without limits using the latest in low-code development, including new GPT-powered capabilities.    Click Here to Register Today!    

Check out the new Power Platform Communities Front Door Experience!

We are excited to share the ‘Power Platform Communities Front Door’ experience with you!   Front Door brings together content from all the Power Platform communities into a single place for our community members, customers and low-code, no-code enthusiasts to learn, share and engage with peers, advocates, community program managers and our product team members. There are a host of features and new capabilities now available on Power Platform Communities Front Door to make content more discoverable for all power product community users which includes ForumsUser GroupsEventsCommunity highlightsCommunity by numbersLinks to all communities Users can see top discussions from across all the Power Platform communities and easily navigate to the latest or trending posts for further interaction. Additionally, they can filter to individual products as well.   Users can filter and browse the user group events from all power platform products with feature parity to existing community user group experience and added filtering capabilities.     Users can now explore user groups on the Power Platform Front Door landing page with capability to view all products in Power Platform.      Explore Power Platform Communities Front Door today. Visit Power Platform Community Front door to easily navigate to the different product communities, view a roll up of user groups, events and forums.

Microsoft Power Platform Conference | Registration Open | Oct. 3-5 2023

We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5 2023! But first, let's take a look back at some fun moments and the best community in tech from MPPC 2022 in Orlando, Florida.   Featuring guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, Stephen Siciliano, Hugo Bernier and many more.   Register today: https://www.powerplatformconf.com/   

Users online (3,452)