Default to Expression Mode

Certified Senior Developer

Is there any way to make Appian open objects in expression mode by default?

I'm not a fan of using my mouse, so design mode isn't really my thing. 

  Discussion posts and replies are publicly visible

  • 0
    Certified Senior Developer

    Hi Aakash,

    As far as I know, there is no direct way or kind of a setting to directly open all interface objects in expression mode. But there is a work around to this and this is not a best practice. But if your interface objects has nested if functions being used, if we directly pass the resulting true part and false part instead of  using an if again inside the outer if() function. So For Eg., Instead of giving the following code by using two if functions this way,

    if(
      1 = 0,
      a!boxLayout(),
      if(
        1 = 2,
        a!cardLayout(),
        a!fileUploadField()
      )
    )

    If we code the above expression in the below format, we end up opening the interface object by default in expression mode,

     

    if(
      1=0,
      a!boxLayout(),
      1=2,
      a!cardLayout(),
      a!fileUploadField()
    )

    Also, apparently if we end up having too many versions of an interface object, the object by default opens in expression mode.

    If we pass an additional parameter that is not present in the actual rule called in the object, we end up opening the interface in expression mode by default. For Eg., the below code would result in opening the interface in expression mode by default since show is not a valid parameter for a!boxlayout(),

    if(
      1 = 0,
      a!boxLayout(
        show: true
      ),
      if(
        1 = 2,
        a!cardLayout(),
        a!fileUploadField()
      )
    )

    You can also use the shortcut keys to toggle between design and expression mode -  Ctrl + M (Windows and Mac)

  • 0
    Certified Lead Developer
    in reply to Athira Vinodkumar

    I've also (accidentally) figured out the thing about passing a nonexistent parameter to a function, as mentioned in our second example.

    Here's the way I typically do it:

    a!formLayout(
      label: "my form",
      useExpressionMode: true(), /* fake parameter, so there should be no net effect other than forcing expression mode */
      contents: {
        ...
      }
    )