cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kusum01
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
WarrenBelz
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
WarrenBelz
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
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.

Top Solution Authors
Top Kudoed Authors
Users online (68,818)