cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Km00
Helper III
Helper III

I need help splitting a array, removing a value that matches some dynamic content i have from another get item, that put the array back together

I need help splitting a array, removing a value that matches some dynamic content i have from another get item, that put the array back together

I have this column in a sharepoint file library called "Department_List".  This has a bunch of values that look like this separated by a comma.

["1.1.1 New Department"],["2.2.2 New 2 Department"], ["3.3.3 New 3 Department"],etc.

 

What happens is the flow is kicked off from a Delete Department in Powerapps.  That then runs and removes the department from a separate Department SharePoint List but  I also need it to go into the Document Library, see if that Department Title is in that 'department_list' column, remove it while leaving the other values there.

 

Click trash icon in Powerapps for department 2.2.2 New 2 Department, workflow kicks off, it goes into my other Department SharePoint List, deletes it from there, then need to hop over to the 'smc doc library' search for that same 'title' in the "department_list" column and remove it but still keep the other values.

 

I hope that explained it. 

Km00_0-1621890757019.png

 

5 REPLIES 5
tom_riha
Super User
Super User

Hello @Km00 ,

I'd probably use the 'Filter array' action for this. Get all the current values in the column, and then in 'Filter array' filter only those that are not equal to the dynamic content (the deleted value). That will create an array with only the remaining values and you can update them back.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

can you help me with a example?  I'm not getting it right apparently.

 

@tom_riha 

Km00
Helper III
Helper III

this variable has all the column items in it for that item, but i need to remove the one we previously deleted with, i have a variable for as well called 'varDepartmentDeletedTitle.  Find row that has 50. asdfsadfsadf in it, remove that, put everything else back together.

Km00_2-1621971137555.png

 

Km00_1-1621971131578.png

 

Km00
Helper III
Helper III

Ive tried and failed on everything.  

 

I just need to know how to filter a array and remove 1 value from it and then update the array without that 1 value so i can update sharepoint.

 

i ended up creating a variable call varArray. I split the array so it looks like this:

Km00_0-1622142849694.png

 

i then need to filter varArray to remove a text that i put into a different variable:  varDepartmentDeletedTitle.  the varDepartmentDeletedTitle is a string as it is just a single line of text.

 

if you can see from the screen shot for example, i just deleted 8.1 System Waste Reduction from my Department List, so now i need to remove it from this array and re-update the sharepoint list with the new array minus the deleted department.  Can anyone help with this?

 

Hello @Km00 ,

looking at the department variable, you should get the value without the HTML tags first. Use the 'HTML to text' action for that. The output of that action will be only the value, e.g.

50. asdfasdfa

Once you have the value, I'd format it in the same way as all the other values in the array, that means adding the [\" before the value and \"] at the end.

concat('[\"', OutputFromHTMLtoText, '\"]')

That should give you the value in the same format as in the array.

[\"50. asdfasdfa\"]

Now you can use the 'Filter array' to filter from the array only the items where item() is not equal to the value. image.png NOTE: the format of the values might be different in your use case, just make sure that the values in the array have the same format as the value you're trying to remove.

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Top Solution Authors
Users online (3,721)