cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

unable to copy Excel cells in new column where condition=true

Hello everybody,

 

I am trying to create a flow that takes Excel,

1) checks if Content column is Empty,

2) adds a new column (Key 2)

3) copies value from Key to Key 2 in front of the Name.

4) If the Name repeats, it should create a new column (Key3) in front of the earlier record of the same Name.

 

Please see below to understand.

The Table I have:  

 

ZainabRao_3-1601283130131.png

 

What I want the flow to return any one of the following:

The first option is priority.

ZainabRao_1-1601282743671.png 

I don't mind if the flow creates (let's say)15 columns at step 2 and only fills 4 at the end of a successful Run. 

 

second option:

ZainabRao_0-1601287587422.png

 

 

I already have the condition to check if the Content is Empty. But I am unable to figure out the rest. 

What I already have: 

ZainabRao_4-1601283354408.png

 

 

 

 

 

Thank you!!

 

Best regards,

Zainab 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: unable to copy Excel cells in new column where condition=true

Hi @ZainabRao,

 

I have a method that could get following output at the end of a successful Run. There are some repeat Key 2 values in cells.

Screenshot 2020-09-30 100942.jpg

 

Steps:

1. Create a column named Key2 in Excel table manually. Initialize an array variable named KeyCollection to hold keys.

Screenshot 2020-09-30 101404.jpg

2. Create an Apply to each to loop rows, then create a Condition to check Content column if equals empty.

3. If empty, create second list rows present in an Excel table action with Filter query: Name eq '@item()?['Name']'

Screenshot 2020-09-30 101336.jpg

 

4. Append these Key value into the array variable, then use join() function convert the array into a string:

join(variables('KeyCollection'),',')

Screenshot 2020-09-30 101439.jpg

 5. Then append the keycollection string to the key2 column, then set the KeyCollection variable to null.

Screenshot 2020-09-30 101455.jpg

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: unable to copy Excel cells in new column where condition=true

Hi @ZainabRao,

 

I have a method that could get following output at the end of a successful Run. There are some repeat Key 2 values in cells.

Screenshot 2020-09-30 100942.jpg

 

Steps:

1. Create a column named Key2 in Excel table manually. Initialize an array variable named KeyCollection to hold keys.

Screenshot 2020-09-30 101404.jpg

2. Create an Apply to each to loop rows, then create a Condition to check Content column if equals empty.

3. If empty, create second list rows present in an Excel table action with Filter query: Name eq '@item()?['Name']'

Screenshot 2020-09-30 101336.jpg

 

4. Append these Key value into the array variable, then use join() function convert the array into a string:

join(variables('KeyCollection'),',')

Screenshot 2020-09-30 101439.jpg

 5. Then append the keycollection string to the key2 column, then set the KeyCollection variable to null.

Screenshot 2020-09-30 101455.jpg

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Frequent Visitor

Re: unable to copy Excel cells in new column where condition=true

@v-litu-msft  Thank you BIG TIME!!! 

 

I know how to add Key2 via Flow and I can delete the duplicate records. 

You explained it very well and I used the commands with my Flow successfully. 

 

Have a great week ahead!! 🙂

 

Best regards,

Zainab 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (7,303)