cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Filling rows According to a Condition

Hello,

I'm working on a flow. This flow gets email excel attachments and create a folder in one onedrive business folder. Then excel content moves to another excel file in another folder in onedrive business. During this adding process, I'm trying to fill some rows according to some conditions with wdl.

You can find below my flow and expression:

fl1.PNGfl2.PNG

 

I want to fill COLUMNA with a specific value and my expression is like below:

 

if(and(equals(item()?['VENDOR No.'],11276),equals(item()?['UNIT PRICE (condition PB00)'],0)),equals(item()?['COLUMNA'],'Consignment'),item()?['COLUMNA'])
 
I'm trying to write in above expression fill the COLUMNA A as Consignment if Vendor No is 11276 and Unit Price is 0.
 
Is there anyone to help me?
Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi again!

Glad you made some progress on this topic!

THe new error states some of the dynamic content values assigned to the expression cannot be converted into int().

 

Taking into account the expression you shared in your original post does not use int() function I guess you have modified it since.

 

Now on the error, it probable means that the dynamic content value who is causing it is:

  • either null (empty cell); or
  • of type string but its content cannot be converted into a number (maybe due to special characters inside, hidden spaces, letters... or perhaps a decimal number)

You can probably add a 'Compose' action block just before 'Add a row into a table' just to print inside the dinamyc contents you are about to use as ingredients of your WDL expression

 

It's difficult to say without more context related info (what the new WDL expression is, what's the values of the dynamic contents that are throwing the error).

 

Anyway, good luck with your new challenge!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

6 REPLIES 6
efialttes
Super User
Super User

Hi!

First, you probably need to convert 0 and 11276 into a string. I would try with the following expression instead:

 

if(and(equals(item()?['VENDOR No.'],'11276'),equals(item()?['UNIT PRICE (condition PB00)'],'0')),equals(item()?['COLUMNA'],'Consignment'),item()?['COLUMNA'])

 

but please note the following. If WDL funtion requires the following structure

if(<expression>, <valueIfTrue>, <valueIfFalse>)

Now your <expression> is:

 

and(equals(item()?['VENDOR No.'],'11276'),equals(item()?['UNIT PRICE (condition PB00)'],'0'))

 

Now let's assume <expression> is true. Your <value if true> is of type boolean (true/false):

 

equals(item()?['COLUMNA'],'Consignment')

 

Now let's assume <expression> is false. Your <value if false> is of type... string?:

 

item()?['COLUMNA']

 

Not sure the two possible output <values> share the same data type, meaning it will probably throw an error

 

Hope this helps

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Anonymous
Not applicable

Dear @efialttes  thanks for your reply.

This condition is okey, it worked. The problem was because of the column name. I have fixed the column name and the problem is solved.

But When I work with another excel file and its vendor name is not equal to 11276, I'm getting the below error:

error1.PNGerror2.PNG

 

Because of the error I've thought that if the condition paramater (Vendor no)in the above expression is not equal to 11276 then  add row raises error? Can it be right? And how can I solve this issue?

Thanks.

 

Hi again!

Glad you made some progress on this topic!

THe new error states some of the dynamic content values assigned to the expression cannot be converted into int().

 

Taking into account the expression you shared in your original post does not use int() function I guess you have modified it since.

 

Now on the error, it probable means that the dynamic content value who is causing it is:

  • either null (empty cell); or
  • of type string but its content cannot be converted into a number (maybe due to special characters inside, hidden spaces, letters... or perhaps a decimal number)

You can probably add a 'Compose' action block just before 'Add a row into a table' just to print inside the dinamyc contents you are about to use as ingredients of your WDL expression

 

It's difficult to say without more context related info (what the new WDL expression is, what's the values of the dynamic contents that are throwing the error).

 

Anyway, good luck with your new challenge!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Anonymous
Not applicable

Dear @efialttes  before I read your post I have added not empty control to my expression :). But I thank you very much for your fast answers and help.

 

@Anonymous 

Problem solved, right?

Hurray! Great Job!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Anonymous
Not applicable

Yes, problem is solved. Thank you very much @efialttes 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,220)