cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ChrisCC
Level: Powered On

Distinct Values From SP List

Is it possible to generate an array with the Compose function based on a Sharepoint list, but only distinct values? I want the following code to run:

 

MyArray[item];

for each (item in MyArray){
    if (MyArray.contains(item)){ // note1
        do nothing;
    else
      (MyArray.push(item))
    }
}

I am getting hung up recreating the line note1 is on. I can't seem to use the contains condition on an array I am working on

 

I am using the compose feature to make the array which I think has to do with it...thanks for any help

4 REPLIES 4
efialtes
Level 8

Re: Distinct Values From SP List

@ChrisCC

You can try with WDL union function (https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language)

According to the definition of this funtion, it should work even with one input parameter, so in theory you do not even need the foreach. 

 

Also if you have the dictionary with all possible values in advance, you can try with WDL intersection function.

 

I am afraid I have never tried iany of these expressions before

 

Please note some days ago Flow team has completed the rollout of a new feature, so that you can use expressions in action blocks, Compose workaround is not mandatory anymore

(https://emea.flow.microsoft.com/en-us/blog/use-expressions-in-actions/)

ChrisCC
Level: Powered On

Re: Distinct Values From SP List

Ended up solving this by just dumping the data to a SQL table

Community Support Team
Community Support Team

Re: Distinct Values From SP List

Hi @ChrisCC,

 

To filter array, Flow has an Action call Filter Array, which allows to apply fitler under each item within the array, take a look at the blog below:

Build more advanced flows than ever

Checking the Filter Arrarys part.

Post back if you have any further questions.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
automaton
Level: Powered On

Re: Distinct Values From SP List

I can see you found a workaround for this but if the need comes up again I solved it like this.

 

https://powerusers.microsoft.com/t5/Flow-Cookbook/How-to-get-unique-column-values-from-a-SharePoint-...

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users Online
Currently online: 168 members 4,526 guests
Please welcome our newest community members: