cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Microsoft
Microsoft

Need Unique names from multiple labels

Hi There,

 

I am stuck at last leg of my project and need your support with the last action which i am stuck at.

 

I have multiple labels with repetitive text and i need distinct names from all labels to one label.

 

Example Situation:

 

Label1 - John

Label2 - Peter

Label3 - Walter

Label4 - John

Label5 - Peter

 

Result needed in one label - John, Peter, Walter

 

Can someone help me with the possible solution here, appreciate the same.

 

Thanks

Kusum

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @Kusum01 ,

Something like the below?

CollectLabels.gif

 

 

 

 

 

 

 

 

 

 

 

Call the variables whatever you want, but you will need a collection - code on the Collect button above (the Labels are N1-5)

ClearCollect(
    colDist,
    {AA: N1.Text},
    {AA: N2.Text},
    {AA: N3.Text},
    {AA: N4.Text},
    {AA: N5.Text}
)

Now the tricky bit - the label you see with the end result has this code

With(
   {        
      vTest: 
      Concat(
         Distinct(
            colDist,
            AA
         ),
         Result & ", "
      )
   },
    Left(
        vTest,
        Len(vTest) - 2
    )
)

Happy to elaborate on the logic.

 

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.

 

View solution in original post

2 REPLIES 2
Super User III
Super User III

Hi @Kusum01 ,

Something like the below?

CollectLabels.gif

 

 

 

 

 

 

 

 

 

 

 

Call the variables whatever you want, but you will need a collection - code on the Collect button above (the Labels are N1-5)

ClearCollect(
    colDist,
    {AA: N1.Text},
    {AA: N2.Text},
    {AA: N3.Text},
    {AA: N4.Text},
    {AA: N5.Text}
)

Now the tricky bit - the label you see with the end result has this code

With(
   {        
      vTest: 
      Concat(
         Distinct(
            colDist,
            AA
         ),
         Result & ", "
      )
   },
    Left(
        vTest,
        Len(vTest) - 2
    )
)

Happy to elaborate on the logic.

 

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.

 

View solution in original post

Thanks much @WarrenBelz  this solution worked exactly as required with very minor tweak for Len formula.

 

Much appreciated and thanks again !!! 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (69,039)