Using rule!UNI_TEST_UTIL_debugBox()

is there a way to use rule!UNI_TEST_UTIL_debugBox() in an Expression Rule?

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Where is that rule from and what does it contain?  I'm not sure it's anything that people here will know about by default.

  • There may be one or more expression or interface rules in circulation facilitate an "enhanced" interface debugging capability.
    This sounds like one of them. 

    The one's that I've seen are cool. 
    That said, they also are typically based on unsupported functions, and so I would urge caution.

    David, 
    What are you experiencing at design time with your expression design that led to this question?

  • I am working on a program in Expression Rule and was hoping to display/ view the exact data that is being saved for certain locals and functions. However, I am not finding anything that will enable that. it looks like the Rule I noted above was custom and only works for interfaces. No biggie.

    Thank you,

  • 0
    Certified Lead Developer
    in reply to David Anaya
    hoping to display/ view the exact data that is being saved for certain locals and functions.

    Generally speaking you just need to construct your rule output so that you can output debug values when needed.

  • 0
    Certified Lead Developer

    No, debug box won't work.  What you can do, however, is use curly braces.

    Your standard expression rule might be:

    load([or a!localVariables( ]

    local!var_1,

    local!var_2,

    ...

    local!var_n,

    expression: //code goes here

    )

    You can also do:

    load(

    local!var_1,

    ...

    local!var_n,

    {

    expression1: //code goes here ,

    expression2: //more code goes here ,

    expression3: //even more code goes here

    }

    )

    You can do all sorts of things with this, including printing out all your local variables.  Your expressions could be:

    {

    concat("This is local ! var 1: ", local!var_1),

    concat("This is local ! var 2: ", local!var_2),

    concat("This is local ! var 3: ", local!var_3)

    }

    Comment out your code, or ask for a list of all local variables before output of the existing code.  Only run some of it.  Demand the first half and after that quite separately the second half.  Ask for all local variables first, then your code, then all the local variables again.  You can do anything provided you're not on the Prod environment.

    I've been where you are.  I so rarely trust the machine for anything.  I demand that it tells me what on Earth it's thinking frequently.

  • 20.1 will allow you to view the values of local! vars when created inside an a!localVariables in design mode within SAIL....gonna be sweet!  Alternatively, you can build a debug box that uses the eval function.

  • 0
    Certified Lead Developer
    in reply to Jacob Edelman

    Eval doesn't buy you anything you don't already have with an expression rule, but all my nonsense isn't necessary anymore either, provided you're upgrading to 20.1.  Thanks Appian!  It's actually going to be super sweet not having to do either thing in the future.

    Let it be known far and wide there is absolutely no use for the eval (pronounced evil) function anymore.  Do not use, unless you're still on pre-20.1.

  • Only thing I can see as a gap for 20.1 is the ability to have a popup window shows the values when running sail in tempo/sites in a debugger.  That would be awesome.  Similar to what you can do for an IDE.

    Eval lets you get real time values from local! or ri! vars in sail that is run outside design:

    load(
      local!input,
      local!show: true,
      local!readOnly: true,
      with(
        {
          if(
            local!show,
            a!richTextDisplayField(
              labelPosition: "COLLAPSED",
              value: {
                a!richTextImage(
                  image: a!documentImage(
                    document: a!iconIndicator(
                      icon: "STATUS_WARN"
                    )
                  ),
                  size: "ICON"
                ),
                a!richTextItem(
                  text: " For Debugging",
                  style: "STRONG"
                ),
                a!richTextItem(
                  text: " ("
                ),
                a!richTextItem(
                  text: if(local!show, "Hide", "Show"),
                  link: a!dynamicLink(
                    value: not(local!show),
                    saveInto: local!show
                  )
                ),
                a!richTextItem_18r1(
                  text: ")"
                )
              }
            ),
            {}
          ),
          if(
            local!show,
            {
              a!paragraphField(
                value: local!input,
                saveInto: a!save(local!input, tostring(save!value)),
                labelPosition: "COLLAPSED"
              ),
              a!textField(
                label: "Type",
                value: try(typename(typeof(eval(local!input))), "ERROR"),
                readOnly: true
              ),
              a!textField(
                label: "Length",
                value: try(count(eval(local!input)), "ERROR"),
                readOnly: true
              ),
              a!paragraphField(
                label: "Results",
                value: try(eval(local!input),fn!lastError().details),
                readOnly: true,
                heigh: "SHORT"
              )
            },
            {}
          )
        }
      )
    )
    

  • 0
    Certified Lead Developer
    in reply to Jacob Edelman

    Oooh, you and your still letting the evil function (eval()) be useful for something!