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 / Collection and you nee...
Power Apps
Answered

Collection and you need to Split string containing ID values (2,3,14) and return a label for each one based on a Lookup

(0) ShareShare
ReportReport
Posted on by 678

I have a string 2,3.14 and I can split it and then do a lookup and then concat it to get the labels from each value based on a Lookup. I have done it as a 3 step process. I need to combine this into a single step and plan to do this for each row in a collection. This example is just starting with a singular string for ease of demonstration.
Region Capture.jpg

The initial input default text is 

"2,3,14,"

The Split button on select does this...creating a collection

ClearCollect(Test,Filter(Split(TextInput2.Text,",").Result,!IsBlank(Result)))

The GetLookUp Button adds the Label for each row...and creates a local var of the concatenated Label

ClearCollect(
 Test2,
 AddColumns(
 Test,
 "Label",
 LookUp(
 ListDictionary,
 ID = Value(Result),
 Title
 )
 )
);
UpdateContext({Final: Concat(Test2,Label&", ")})

 Where the label text value is simply

Final

rendering the output desired of ...Active, Passed, Failed, 

Brilliant...
But how do I do this with the least amount of code when trying to do this with all the rows in a collection...as you can see here the region and the countries have these types of strings that all need to be "translated". The gallery is using a collection that is being created on the "onVisible" property for the page.
Region Capture2.jpg

 




 

Categories:
  • Verified answer
    bobesponja Profile Picture
    258 on at

    If you just need this to display in the gallery, you can avoid any extra collections/variables and just use this formula in the Text field of the Region and Countries columns (apologies for the strange indentations, I figured an unformatted example would be harder to read):

    With(
     {text: Concat(
     Filter(Split(ThisItem.CommaList, ","), !IsBlank(Result)),
     LookUp(ListDictionary, ID=Value(Result), Title) & ","
     )},
     Left(text, Len(text)-1)
    )

     

  • sasrsc Profile Picture
    678 on at

    Wow, yes...much better and thank you for reading into my intent.
    I only need it for display purposes in the gallery.

  • PaulineShare Profile Picture
    25 on at

    Thank you bobesponja!! This is exactly what I need to do

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard