timer function in Interface?

Certified Associate Developer

Hello.

I have and component(card layout) shown in the interface using showWhen() function,

and want it to disappear after 30 seconds.

I thought of using the showWhen() function and refreshInterval of refreshVariable, but couldn't make it work.

I'd appreciate it if you could let me know if there is a way to make this possible.

Thank you.

  Discussion posts and replies are publicly visible

Parents
  • You can achieve that without user interaction:
    There is a small issue, it's not exactly 30 seconds, because when you set the refreshInterval as 0.5, it is not exactly 30 seconds, but somewhere around it. From some tests I did, it's around 25 seconds.

    a!localVariables(
      local!timeFlag: now() + second() * 15,
      local!show: a!refreshVariable(
        value: now() < local!timeFlag,
        refreshInterval: 0.5
      ),
      a!cardLayout(
        showWhen: local!show,
        style: "WARN"
      )
    )

Reply
  • You can achieve that without user interaction:
    There is a small issue, it's not exactly 30 seconds, because when you set the refreshInterval as 0.5, it is not exactly 30 seconds, but somewhere around it. From some tests I did, it's around 25 seconds.

    a!localVariables(
      local!timeFlag: now() + second() * 15,
      local!show: a!refreshVariable(
        value: now() < local!timeFlag,
        refreshInterval: 0.5
      ),
      a!cardLayout(
        showWhen: local!show,
        style: "WARN"
      )
    )

Children