Skip to main content

19 replies

stewart.burchell
Employee
Sep 8, 2022 12:00 PM UTC

We need a little bit more to go on. Do you mean:

  • the time of day?
  • the elapsed time since something started?
  • the remaining time you have left to finish something by?
Known Participant
Sep 8, 2022 12:23 PM UTC

Yes

mikes0011
Brainy
Sep 8, 2022 12:45 PM UTC
Yes

But which one are you saying "Yes" to?  Those were 3 separate (mutually exclusive) questions...

The Expression Guru
Inspiring
Sep 8, 2022 12:10 PM UTC

In the meantime until Appian introduce the functionality, you can refresh the time after every 30 seconds by using refresh interval and show that time.

Known Participant
Sep 12, 2022 5:53 AM UTC

Thank you [mention:6a17174541734ea98f60de800dbbac95:e9ed411860ed4f2ba0265705b8793d05]

harshitb6843
Brainy
Sep 8, 2022 12:16 PM UTC
Known Participant
Sep 8, 2022 12:20 PM UTC

Yes like Appian Exam I want to make a timer

csteward
Brainy
Sep 8, 2022 5:30 PM UTC

Just for an OOTB example, I implemented something for a similar requirement with a!gaugeField() for a countdown timer in a Meeting Minute type app:

/* rule inputs are datetime */

a!localVariables(
  local!notSet: or(
    rule!APN_isEmpty(ri!start),
    rule!APN_isEmpty(ri!end),
    rule!APN_isEmpty(ri!current),
    ri!currentlocal!duration,0,local!duration-local!durationIn)),
  local!pct: if(local!notSet,0,trunc((local!durationIn/local!duration)*100,0)),

  {
    a!gaugeField(
      labelPosition: "COLLAPSED",
      percentage: local!pct,
      primaryText: if(local!notSet,"---",local!remainingMinutes),
      secondaryText: "mins remain",
      color: rule!MM_getGaugeColorForPct(
        pct: local!pct,
        notSet: local!notSet
      ),
      size: "MEDIUM",
      align: "CENTER",
    )
  }
)

Helper rule!MM_getGaugeColorForPct() (this could be optimized..):

if(
  ri!notSet,
  "#afafaf",
  if(
    ri!pct < 20,
    "#008000",
    if(
      and(
        ri!pct >= 20,
        ri!pct < 40
      ),
      "#a4d100",
      if(
        and(
          ri!pct >= 40,
          ri!pct < 60
        ),
        "#f9fc00",
        if(
          and(
            ri!pct >= 60,
            ri!pct < 80
          ),
          "#ff8500",
          if(
            ri!pct >= 80,
            "#ff0500",
            "#afafaf"
          )
        )
      )
    )
  )
)

mikes0011
Brainy
Sep 8, 2022 5:36 PM UTC
this could be optimized..

hint: a!match() executes its "whenTrue" parameters in order, choosing only the first one that returns true (which would get rid of your and() statements altogether, because you'd just go from the bottom up in evaluating values of ri!pct).

Edit: i got bored so

a!match(
  value: ri!pct,
  
  whenTrue: ri!notSet,
  then: "#afafaf",
  
  whenTrue: fv!value < 20,
  then: "#008000",
  
  whenTrue: fv!value < 40,
  then: "#a4d100",
  
  whenTrue: fv!value < 60,
  then: "#f9fc00",
  
  whenTrue: fv!value < 80,
  then: "#ff8500",
  
  whenTrue: fv!value >= 80,
  then: "#ff0500",
  
  default: "#afafaf"
)

The Expression Guru
csteward
Brainy
Sep 8, 2022 5:40 PM UTC

For sure that is a better solution with a!match() (for those on Appian 22.1 or newer), this was a weekend/internal/concept project for fun, quick build back a few years ago [emoticon:41d3875e132d40cdaee3dc767007b788]