How to create IF functions inside logicalTest parameter for IF function in Microsoft Graph?

39 Views Asked by At

I was told it may be possible to nest IF functions inside the IF function in Microsoft Graph but I cannot figure out the syntax.

I want to recreate a function like this =IF(A1="", B1, (B1*C1*D1))

So in Microsoft Graph, instead of a simple body for the IF statement being

{ 
  "logicalTest": true, 
  "valueIfTrue": 20, 
  "valueIfFalse": 10 
}

it could be something like

{ 
  "logicalTest": "1=1", 
  "valueIfTrue": 20, 
  "valueIfFalse": 10 
}

but I can't figure out the correct syntax to make it work.

This is the documentation for the if function, and according to the doc, it may be possible. But I posted a similar question last month and user said it should be possible but can't figure out the syntax.

Any ideas? Thank you!

I've tried experimenting with different syntaxes but no luck; =true "=true" '=true' =1=1 "=1=1".

1

There are 1 best solutions below

1
On

There is no official documentation for this, but based on my testing:

  • logicalTest property accepts only true/false value
  • valueIfTrue, valueIfFalse properties accept boolean, number or string
{ 
  "logicalTest": true, 
  "valueIfTrue": 20, // "Yes", true
  "valueIfFalse": 10 
}

What's not working for if function even if it works for other functions is a json that represents a reference to an excel cell with true/false value

{ 
  "logicalTest": {
    "address": "Sheet1!A1"
  }, 
  "valueIfTrue": 20,
  "valueIfFalse": 10 
}

or string with expression to be evaluated

{ 
  "logicalTest": "=TRUE()", 
  "valueIfTrue": 20,
  "valueIfFalse": 10 
}

In both cases, the endpoint returns error response.