Expression To return Screen type (Phone, Desktop, tab, desktop_wide etc)

I want to get the current screen type in which my interface opened.
Here screen type I mean : "PHONE" , "DESKTOP", "DESKTOP_WIDE" etc 
I tried using a!isPageWidth() but that is not working for my requirement.

Please help me with this.
Thank you in advance!! 

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to ujjwalrathore

    I suppose it might be helpful to build it in such a way that we could maintain a separate array of valid widths (like in a constant) then have a rule simply iterate over that list and find the valid width (if any).

    /* rule!GLBL_getPageWidth() */
    a!localVariables(
      local!widths: {
        "PHONE", "TABLET_PORTRAIT", "TABLET_LANDSCAPE", "DESKTOP_NARROW", "DESKTOP", "DESKTOP_WIDE"
      },
    
      index(
        a!flatten(a!forEach(
          local!widths,
          if(
            a!isPageWidth(fv!item),
            fv!item,
            {}
          )
        )),
        1,
        "Unknown"
      )
    )

Children