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

Replacing characters in file with placeholders

Hello community,

 

I have a flow that is replacing some place holders inside a HTML format handover form:

Handover form:

CristianF_0-1638971354181.png

 

Flow:

CristianF_0-1639041847292.png

CristianF_1-1639041890416.png

CristianF_3-1639041959861.png

When new item is created in sharepoint list the flow is picking the HTML form template from library, is replacing the placeholders %code1,2,3...% with proper information from the list and Compose 3 action it is used only for checking the outcome but when I will get the flow to work as desired it will save the form as attachment in sharepoint list item.

The flow is successfully running but my problem is that it is multiplying the form once by 8 times since there are 8 placeholders and again by as many items i have created in the list. In my example i had 41 items created in sharepoint list so the outcome of the flow was 1 * 8 * 41 = 328 forms 😯. I know that Apply to each action is multiplying the forms but i cannot find a way to work arround it. I tried to remove the action but when the flow runs compose 2 action is failing with error:

CristianF_4-1639045042974.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @CristianF ,

 

I noticed that in the apply to each loop you are first setting replacing the characters and assigning it to the "text" variable.

 

Now the Compose 2 action has a new clone of "text" variable data with replaced characters.

 

For the next action, you chose to append the result of Compose 2( which holds a copy of text variable) back to the text variable - this is causing the form to double after the first loop and triple on the second, so on and on.

 

Please replace your "Append to string" action with a "Set Variable" action instead, this would not append the resulting replaced text, instead will set it back to text variable

 

Hope you find this helpful!

 

Kind Regards,

Shaik Sha
________________________________________________________________________

If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
CristianF
Helper III
Helper III

Hello Community,

 

Is there really no one that could help me with my issue ?

Hello @CristianF ,

 

I noticed that in the apply to each loop you are first setting replacing the characters and assigning it to the "text" variable.

 

Now the Compose 2 action has a new clone of "text" variable data with replaced characters.

 

For the next action, you chose to append the result of Compose 2( which holds a copy of text variable) back to the text variable - this is causing the form to double after the first loop and triple on the second, so on and on.

 

Please replace your "Append to string" action with a "Set Variable" action instead, this would not append the resulting replaced text, instead will set it back to text variable

 

Hope you find this helpful!

 

Kind Regards,

Shaik Sha
________________________________________________________________________

If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

CristianF
Helper III
Helper III

@Mister_Shaik you are a legend !

Thank you very much ! It works perfect now.

Best regards !

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,401)