cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jojodev86
New Member

Duplicate Headers in output

Hi all, 

 

I have created the below flow and it it returning duplicate headers. Is there anyway that I can keep the first header and do away with the duplicates? Tried the union function and concat but must not be using them in the correct order as they haven't worked

 

Any help is greatly appreciated 🙂

Thank you 

Jojodev86_0-1670328271610.png

Jojodev86_1-1670328319771.png

 

 

9 REPLIES 9
Expiscornovus
Super User
Super User

Hi @Jojodev86,

 

I assume your LoopsVar variable is of type integer and starts with a 0? You could use that LoopsVar value to check if it is the first loop. If that is the case you want to use the Header. In all other cases you want to skip that first row.

 

Below would be an example expression for within the loop (probably for your append to string variable):

if(equals(variables('LoopsVar'), 0), body('Create_CSV_Table'), join(skip(split(body('Create_CSV_Table'), decodeUriComponent('%0A')),1), decodeUriComponent('%0A')))

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


It is an Integer but begins with a 1... would I include that expression you have commented in the append csv variable but just change what you have written to a 1?

Jojodev86
New Member

Jojodev86_0-1670333280899.png

 

Jojodev86
New Member

I think the loop can run up to 6 times 

Expiscornovus
Super User
Super User

Hi @Jojodev86,

 

If you initalize your LoopsVar variable with 1, than you would need to update the 0 to 1 in the expression.

 

Can you try the below within your Do Until loop?

if(equals(variables('LoopsVar'), 1), body('Create_CSV_Table'), join(skip(split(body('Create_CSV_Table'), decodeUriComponent('%0A')),1), decodeUriComponent('%0A')))

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Jojodev86
New Member

Hi, 

 

I input the expression next to the output in my append to sting variable and it brought back the data x2

 

When I try add the expression into IcrLoops it advises that it is invalid 

 

Should I try put the expression in the append to sting variable before the output? 

 

Sorry if I'm confused but it did get rid of the duplicate headers just duplicated the data 

 

Jojodev86_0-1670338611115.png

 

Expiscornovus
Super User
Super User

Hi @Jojodev86,

 

Yes, it should be in the append to string variable action. 

 

However, you are also using a Do until. So, with every loop it will collect the data via the Power BI query and adds it (append) to the existing data within the variable.

 

What do you want it to do? Can you explain why you are using a Do Until?

 

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Rat2
Frequent Visitor

Hi @Expiscornovus 
Thank you, it worked. 
However, it is not showing the first header as well. 
I need the header for the first loop and rest all it shouldn't. 

Rat2
Frequent Visitor

Hi @Expiscornovus 
I found the solution, Thank you. 

if(equals(variables('LoopsVar'), 2), body('Create_CSV_Table'), join(skip(split(body('Create_CSV_Table'), decodeUriComponent('%0A')),1), decodeUriComponent('%0A')))



Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (4,804)