admin管理员组

文章数量:1336340

I have a problem with my flow in Power Automate. The flow is supposed to check if a row has been added to a table in Excel, and if so, it sends an email. Everything works well until a user adds an empty row where the ID number is not provided. I tried using the empty and coalesce functions, but I think I did it wrong. Please help. Below is the code

Error:Action 'IF_SP_LP_is_bigger_then_LP_from_excel' failed: Unable to process template language expressions for action 'IF_SP_LP_is_bigger_then_LP_from_excel' at line '0' and column '0': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

Code:

  "type": "If",
  "expression": {
    "or": [
      {
        "greaterOrEquals": [
          "@int(body('Get_item')?['Title'])",
          "@int(coalesce(items('For_each_1')?['LP_x002e_'], '0'))"
        ]
      },
      {
        "equals": [
          "@empty('For_each_1')?['LP_x002e_']",
          "@null"
        ]
      }
    ]
  },

I have a problem with my flow in Power Automate. The flow is supposed to check if a row has been added to a table in Excel, and if so, it sends an email. Everything works well until a user adds an empty row where the ID number is not provided. I tried using the empty and coalesce functions, but I think I did it wrong. Please help. Below is the code

Error:Action 'IF_SP_LP_is_bigger_then_LP_from_excel' failed: Unable to process template language expressions for action 'IF_SP_LP_is_bigger_then_LP_from_excel' at line '0' and column '0': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

Code:

  "type": "If",
  "expression": {
    "or": [
      {
        "greaterOrEquals": [
          "@int(body('Get_item')?['Title'])",
          "@int(coalesce(items('For_each_1')?['LP_x002e_'], '0'))"
        ]
      },
      {
        "equals": [
          "@empty('For_each_1')?['LP_x002e_']",
          "@null"
        ]
      }
    ]
  },
Share Improve this question asked Nov 20, 2024 at 6:20 SebastianSebastian 235 bronze badges 1
  • I think I know why but you need to show us some data. Too hard to help given we can’t see the data that you’re processing at the time the error occurs. – Skin Commented Nov 20, 2024 at 7:08
Add a comment  | 

1 Answer 1

Reset to default 0

greaterOrEquals (and other equaluity functions) expects non-null parameters. You can use the 'equals()' like

equals(triggerOutputs('ID'),null)

and then nest the true and false conditions with further equality operators. The final expression would look something like this

if(
equals(triggerOutputs('ID'),null),
null, or '' (empty string) if you want to equate later
triggerOutputs('Name') // or any other field that you want to read.
)

本文标签: Automate Flow fails with empty row in tableStack Overflow