cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DarrylJP Helper I
Helper I

Append to String in Apply to Each Item Array Failing

If anyone could help on this. I have a flow that creates a custom HTML Table that highlights the row a certain color based on the value of 'Aging'. When I get to my Apply to Each stage where I append all the table to the varHTMLTable variable, the test log is showing I get a failure and I can't figure out why.

 

Variable values are as follows:

 

VarStyle
{
  "tableStyle": "style=\"border-collapse: collapse;\"",
  "headerStyle": "style=\"font-family: Helvetica; padding: 5px; border: 1px solid black;\"",
  "cellStyle": "style=\"font-family: Calibri; padding: 5px; border: 1px solid black;\"",
  "rowStyleHighValues": "style=\"font-size:110%;background-color:#ff0000\"",
  "rowStyleLowValues": "style=\"background-color:#ffff00;\""
}
varHTMLTable
<table @{variables('varStyle').tableStyle}>
   <tr>
     <th @{variables('varStyle').headerStyle}>Date Recieved</th>
     <th @{variables('varStyle').headerStyle}>RPATS ID</th>
     <th @{variables('varStyle').headerStyle}>Address</th>
     <th @{variables('varStyle').headerStyle}>Complaint Type</th>
     <th @{variables('varStyle').headerStyle}>Assigned To</th>
     <th @{variables('varStyle').headerStyle}>Aging</th>
   </tr>
Append to String - Rows
<tr @{if(greaterOrEquals(items('Apply_to_each_item_in_the_array')?['Aging'], 7), variables('varStyle').rowStyleHighValues, variables('varStyle').rowStyleLowValues)}>
     <td @{variables('varStyle').cellStyle}>@{items('Apply_to_each_item_in_the_array')?['Date_x0020_Recieved']}</td>
     <td @{variables('varStyle').cellStyle}>@{items('Apply_to_each_item_in_the_array')?['RPATS_x0020_ID']}</td>
     <td @{variables('varStyle').cellStyle}>@{items('Apply_to_each_item_in_the_array')?['Address']}</td>
     <td @{variables('varStyle').cellStyle}>@{items('Apply_to_each_item_in_the_array')?['Complaint_x0020_Type']}</td>
     <td @{variables('varStyle').cellStyle}>@{items('Apply_to_each_item_in_the_array')?['Assigned']}</td>
     <td @{variables('varStyle').cellStyle}>@{items('Apply_to_each_item_in_the_array')?['Aging']}</td>
</tr>
Append to String - Closing
</table>
 
Flow is as follows:
 
20200131Flow1.JPGFlow 120200131Flow2.JPGFlow 220200131Flow3.JPGFlow 3
1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Append to String in Apply to Each Item Array Failing

Hi @DarrylJP ,

 

I think the issue is in data itself , because if are getting the aging column from SharePoint list and its a Number your expression should work fine.

Few more question to get more details:

  1. Is it failing for all rows or only few 
  2. All rows in your SharePoint List has a valid number in aging column?

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

View solution in original post

9 REPLIES 9
Super User
Super User

Re: Append to String in Apply to Each Item Array Failing

Hi @DarrylJP ,

 

Could you please the error message your are getting, we may get some insight with that.

 

Regards, 

DarrylJP Helper I
Helper I

Re: Append to String in Apply to Each Item Array Failing

InvalidTemplate. Unable to process template language expressions in action 'Append_to_string_variable_varHTMLTable_-_rows' inputs at line '1' and column '2783': 'The template language function 'greaterOrEquals' expects two parameter of matching types. The function was invoked with values of type 'String' and 'Integer' that do not match.'.

Super User
Super User

Re: Append to String in Apply to Each Item Array Failing

Hi @DarrylJP 

 

As error says - "'greaterOrEquals' expects two parameter of matching types. The function was invoked with values of type 'String' and 'Integer' that do not match."

 

In your comparison expression , try converting first parameter to integer. like :

greaterOrEquals(int(items('Apply_to_each_item_in_the_array')?['Aging']), 7)

 

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

 

Highlighted
DarrylJP Helper I
Helper I

Re: Append to String in Apply to Each Item Array Failing

Deepak,
 
Changed it
if(greaterOrEquals(int(items('Apply_to_each_item_in_the_array')?['Aging']), 7), variables('varStyle').rowStyleHighValues, variables('varStyle').rowStyleLowValues)
 
I get a new error now
 
Unable to process template language expressions in action 'Append_to_string_variable_varHTMLTable_-_rows' inputs at line '1' and column '2782': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.
Super User
Super User

Re: Append to String in Apply to Each Item Array Failing

Hi @DarrylJP 

 

I should have ask this before , could you please share the output value of items('Apply_to_each_item_in_the_array')?['Aging'], is it not string?

 

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

DarrylJP Helper I
Helper I

Re: Append to String in Apply to Each Item Array Failing

Sorry, I can't seem to find out where to show you what the output is, the only thing that I can see is the "Action Failed" error message.

 

The field aging in the SharePoint list is a number.

Super User
Super User

Re: Append to String in Apply to Each Item Array Failing

Hi @DarrylJP ,

 

I think the issue is in data itself , because if are getting the aging column from SharePoint list and its a Number your expression should work fine.

Few more question to get more details:

  1. Is it failing for all rows or only few 
  2. All rows in your SharePoint List has a valid number in aging column?

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

View solution in original post

DarrylJP Helper I
Helper I

Re: Append to String in Apply to Each Item Array Failing

Deepak,

 

I have confirmed that  all rows in my SharePoint list have an integer between 1-60. There are no blank fields or non-integer fields.

 

The error message indicates it fails on Row 1, so I am going to assume that all the subsequent rows would fail too being the same type of data?

 

 

DarrylJP Helper I
Helper I

Re: Append to String in Apply to Each Item Array Failing

Any further ideas on this. Definitely a frustrating issue that I need to get figured out!

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (5,657)