Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

display watch or digital clock

Certified Lead Developer

I want to show only the time left out of the total time allocated by me. 

Anyone can help me out on this?

  Discussion posts and replies are publicly visible

Parents
  • 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!current<ri!start
      ),
      local!hours: if(local!notSet,0,hour(tointervalds(ri!end-ri!start))),
      local!minutes: if(local!notSet,0,minute(tointervalds(ri!end-ri!start))),
      local!duration: if(local!notSet,0,(local!hours*60)+local!minutes),
      local!curHoursIn: if(local!notSet,0,hour(tointervalds(ri!current-ri!start))),
      local!curMinutesIn: if(local!notSet,0,minute(tointervalds(ri!current-ri!start))),
      local!durationIn: if(local!notSet,0,(local!curHoursIn*60)+local!curMinutesIn),
      local!remainingMinutes: if(local!notSet,0,if(local!durationIn>local!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"
              )
            )
          )
        )
      )
    )

  • 0
    Certified Lead Developer
    in reply to Chris

    Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function 'trunc' parameter 1 [line 16]: Invalid division: Denominator may not be zero (0)

    it is not working its giving me this error

Reply Children