How to display the value of a local variable without using the value field of a text or paragraph field?

Certified Senior Developer

How to display the value of a local variable without using the value field of a text or paragraph field?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    What's your use case?  In general, at least for debugging reasons, you can display the (text) value of a local variable by setting it as any on-form component that displays text to a user (i.e. in the label parameter of a!formLayout or a!sectionLayout, etc).

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    We used to have a reusable text field component expression that uses the fn!eval function. With that we can just paste any local in it and it'll show the content of it. Switching over to the new a!localvaribales , it doesn't work anymore, and it's a hassle to keep replacing the locals in the form label or section label field.

  • 0
    Certified Lead Developer
    in reply to xingc0001

    I think I see what you mean.  Unfortunately since eval() is an unsupported function, I believe Appian's official response to this would be that it's not a usage they support.  For me, when needed I usually just declare a paragraphField near the top of my form, with its value set to the value of whatever local variable(s) i want to keep tabs on, and with a "showWhen" parameter set to FALSE which i comment and un-comment to show/hide.  If you structure the lines of code in the value: parameter correctly, you could get it such that individual variables only ever need to be added once, and if you don't want to show a particular one anymore, just comment out its line, etc.

    I'm not sure if there are any better debugging tricks that would automate it to the extent that you want, though, short of creating a custom plug-in of some sort.

Reply
  • 0
    Certified Lead Developer
    in reply to xingc0001

    I think I see what you mean.  Unfortunately since eval() is an unsupported function, I believe Appian's official response to this would be that it's not a usage they support.  For me, when needed I usually just declare a paragraphField near the top of my form, with its value set to the value of whatever local variable(s) i want to keep tabs on, and with a "showWhen" parameter set to FALSE which i comment and un-comment to show/hide.  If you structure the lines of code in the value: parameter correctly, you could get it such that individual variables only ever need to be added once, and if you don't want to show a particular one anymore, just comment out its line, etc.

    I'm not sure if there are any better debugging tricks that would automate it to the extent that you want, though, short of creating a custom plug-in of some sort.

Children