0

i have big trouble with simple expression with substring.

My goal is merge two sharepoint list to one excel table. And problem is when value is empty that flow crash.

is possible create expression with If statemant, when value is empty, do nothing ?

String

1980034 - John Wick

expression result:

1980034

{
  "id":@{substring(item()?['listItem1'],0,indexOf(item()?['listItem1'],'-'))}
}

Expression works, but when value missing flow crash

7
  • In which action you are using this expression? What should be the default value for id if expression returns empty result? Commented Dec 7, 2022 at 12:01
  • when listItem is NULL i need if statement to do nothing, when is not null do substring Commented Dec 7, 2022 at 12:06
  • ID is only name of column in table Commented Dec 7, 2022 at 12:07
  • 1
    Can you try using either of these expression? if(empty(item()?['listItem1']), '', substring(item()?['listItem1'],0,indexOf(item()?['listItem1'],'-'))) Commented Dec 7, 2022 at 12:13
  • 1
    if(empty(item()?['listItem1']), null, substring(item()?['listItem1'],0,indexOf(item()?['listItem1'],'-'))). Let me know if this works for you. Commented Dec 7, 2022 at 12:14

1 Answer 1

1

Try using either of these expressions:

if(empty(item()?['listItem1']), '', substring(item()?['listItem1'],0,indexOf(item()?['listItem1'],'-')))

OR:

if(empty(item()?['listItem1']), null, substring(item()?['listItem1'],0,indexOf(item()?['listItem1'],'-')))

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.