sharepoint online – If statement in elmType wont work


Good Morning,
I’m trying to customize a column in my SharePoint in order to:

  • send the user to a different action depending on the value of the column “status”.

Ex1.: the customize column will show a button that will start a flow
if the status is “in
Progress”.

Ex2.: the customized column will show a button that will send the user
to the flow approval page if other status.

  • show a different text depending on the status.

So what I did is the following

`{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "=if(($Status) == 'In progress', 'button','a')",
    "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{"id": "aa12ed12-ea81-4128-bf1c-2112d0d126b1"}"
  },
    "attributes": {
    "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover",
      "target": "_blank",
    "href": "http://finance.yahoo.com/quote/"
  },
  "style": {
    "border": "none",
    "background-color": "transparent",
    "cursor": "pointer"
  },
  "children": (
    {
      "elmType": "span",
      "attributes": {
        "iconName": "=if(($Status) == 'In progress', 'Flow','RedEye')"
      },
      "style": {
        "padding-right": "6px"
      }
    },
    {
      "elmType": "span",
      "txtContent": "=if(($Status) == 'In progress', 'Start the Approval','See approval requests')"
    }
  )
}`

As you can see the statement elmType wont work with an if statement. But it does what i need to do if i switch the elmType in “a” or “button”. So how can I make it work?
Thanks in advance.
Have a nice day