Hi,
I'm developing a power automate flow to read regularly a RSS feed, filter it for a keyword, and published it when different from 0 in a MS Teams Channel message (well, succession of messages with an "apply to each" action). I can implement this without any major problems, although the RSS feed as several problems, one of them being it presents no date/time stamp on its items (go figure...).
The summary item of the RSS Feed is HTML code. Sometimes (not often) there is in between of this html code a relative hyperlink in it that is essential to grasp. Because it points to additional relevant info. Other links that point to the item of the Feed are absolutes links. And the relative doesn't work for the users.
After the "Array Filter" action, I have to replace partial text on all the filtered "Summary Items" on it that have a relative link. However, as you all know better than me, the "replace()" works with strings only.
Relative link: 'href='/web'
Absolute link: 'href='https://website.com/web'/...
The replacing part of the absolute link for the relative is easy to attain with something like:
replace(string(body('Array_Filtered')),'href=''/web','href=''https://website.com/web') using the duplicate apostrophes instead of one to account for the apostrophe ' inside the replacement text string (being that it is a special character in power automate that encloses pretry much everything). Not Double quote ", it's 2 consecutive apostrophes ' ' (here with a space in between that shouldn't exist just for show).
The issue here is where and how do I use this...
I've tried to do it in the MS Teams create messenger action, within the existent "apply to each", that publishes a message invoking 3 items in the Filtered RSS Feed Array, to no avail... I could not transform within the HTML box of the message MS Teams action the summary item with a replacement expression.
I've tried to do it placing after the filtering an "Apply to Each" action for the Filtered Array result with a "compose" action but what I get is a string or a "Current item" that I cannot input to the "Apply to Each" for publishing the MS Teams messages. If I select the Summary Item of the Array I get automatically an enclosed succession of "Apply to Each" hat returns the same input & validity (string no array) errors .
How can I get to write back to the array the replaced item text and get this transformed array as an input for the next step? Only by initializing an array as a variable? But how can I update it with the replaced one?
Thanks in advance for any help...
Many thanks @manuelstgomes !!
Just send you another message with some iterations on the adaptation I've done. (sorry everyone seeing this, but it to large to post here; However, I'm committed to publish the solution and the critical pathways in the end)
Still not getting the replacement of the "summary" string component within the Array variable. This is a string with HTML content on it.
As a requirement, I need to further publish all the replaced & not replaced value items in the "summary" component of the array.
I need to perform partial replacement within the full string value of this component which is within the array.
Data is within the array, but I a) cannot get it and/or replace the partial string on it b) and get the full string value with the replacement bit to the "summary" component again for all the items replaced.
This is so frustrating. It should be a simple data operation in whatever array structure that exists. One should be able to get the structure of the array and point to the desired component within the array one wants to update (append/set/etc.). A cascade of apply to each doesn't seems to solve this without appending an index as a new component to the array and indexing one-by-one all the entries in the Array (which are dynamic, not fixed) to point to it?... an humongous complexity...
Sigh...
HI @MJB_PT
I would do the following:
Here's the full Flow:
The formulas are as follows:
replace(item(),'href=''/','https://www.site.org/')
Using this strategy you're always sure that, regardless of what is the relative path is always added to the end.
Build the line
<li>Text <a href="@{outputs('Compose')}">Link Text</a></li>
Can you please check if and let me know if you have any questions?
Cheers
Manuel
-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Anyone could help? Tried a lot of things to no avail... 😞
Hi @v-yiwenxie-msft ,
Thanks for your inputs.
Here it is (sorry in advance for any misused terms/expressions below... I am not a code developer since training, more than 30 years ago; So, bear with me... this is one of a few moonlight ongoing work projects to ease team work):
RSS Feed array items (data/time ones are blanks and auto initialized by the RSS Feed list as 0 or their equivalent initial value)
The above is is not working yet. I need to use in the flow the filtered keyword twice, so initialized it to be used and changed accordingly. In the following filter it should be invoked as a string variable contained in the 'summary' item instead of the direct string input "Regional". It doesn't work. I need also to address CAPS variations, i.e. "regional" or even adding more expressions [or()] , although I have to invoke that list into message subject later on.
replace(string(body('Filter_array_RSS_')),'href=''/web','href=''https://site.com/web')
Obviously this doesn't work because you can't set an array variable with a string...
How can I read the 'summary' item of this array variable, change by replacing part a string variable?
Do I have to build the array from the ground up for all its items?
Then forward:
length(body('Filter_array_RSS_'))
Also, I can't see the set up array variable items in order to invoked them in the MS Teams publish message action. It automatically produces a nested "Apply to each" and I can only invoke items from the filtered array result and not the current variable.
Additionally, it would also be great to add a new item to the Filtered Array object variable. The last 9 characters of the Primary link (a link to a PDF), i.e. "ABCDEF123" could be used to build another link to a permanent HTML direct page with a lot more info on the item (https://site.com/web/[set of fixed names 1]/ABCDEF123/[set fixed names 2]).
Then I could use this new item "primary_permanent_web_link" to publish both links in the message on the teams channel.
Next evolution: keep a sharepoint list(s) of all the RSS Feed filtered data extracted to maintain an archive and to account a solution for the missing date/time stamp. The feed is reset to zero ID feeds at 00h each day, first publication near 8AM, and sometimes randomly updated 1 or more times during the day. But always adding a few new entries, although it retains all the previous ones in the same ID order (i.e, ID=1 to n, 1st alteration ID=1 to n+k [n+1 to n+k being the new entries], 2nd alteration ID=1 to n+k+m [n+k+1 to n+k+m being the new entries], etc... if more daily alterations of the feed exists]. Weekends and holiday are always zero ID feeds, but eventually some new feeds could be published in these days.
Thanks again in advance!
Hi @MJB_PT
Could you take a screenshot of your detailed flow with private information covered up?
Because I need more info to make a test and find a place to input the expression.
If you only want to update an array variable each time in ‘Apply to each’.
You can try to use ‘Set variable’:
The action ‘initialize variable’ can only be used at top level, not nested level.
It’s quite important to know the difference between ‘Set variable’ and ‘append to array variable’ when they are used in ‘Apply to each’:
‘Set variable’ will refresh the variable each time in a loop, which means it will erase the previously existed content in it.
‘Append to array variable’ will retain the previously existed content in it and add new content in it each time in a loop.
Best Regards,
Community Support Team _ Kira Xie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Tomac
986
Moderator
stampcoin
699
Super User 2025 Season 2
Riyaz_riz11
577
Super User 2025 Season 2