Is there any feasability to print the value of a local variable in the runtime & the value it has in the console. (Like other programming languages for debugging)
Discussion posts and replies are publicly visible
Can you tell me where you expect runtime values in the code, and What do you want to achieve it? An example would be great.
Hi Mohan Reddy Kethireddigari what is your requirement initially, why would you like to print value in runtime. AFAIK I wouldn't be possible print the value of a local variable directly during runtime. Appian doesn't provide a built-in console for real-time debugging.
What kind of variables and which runtime do you mean?
If you are saying that in expression rule you want to get an output through localvarible yes that is possible but I am not sure what do you mean by runtime
you may do it like
a!localVariables(
local!a: 4,
local!b: 5,
local!c: local!a +local!b,
local!c
)
this will print the local!c in the output in expression rule
I don't have any specific requirement for that; I was just wondering if it exists.
While performing actions on the site, we can observe the values that local variables hold and how routing occurs based on the print statements.
Runtime printed values aid in faster debugging.
Hopefully, this tool will evolve to include a console in upcoming releases.
Mohan Reddy Kethireddigari Understood your requirement.No built-in console printing for local variables, but workarounds existDisplay value in Interface, Add text/paragraph component showing the variable value(Mostly developer follow this for interface debugging)
Process Variables values are viewable in the Process Instance Monitor - the "Variables" tab in Process Details output will show their current value, and the "Process History" tab will show their values on an ongoing basis throughout the history of that instance as certain nodes are completed.
Local Variables (ones defined via a!localVariables() at least) are shown in a special panel in the Interface Editor, and the evaluated values of all local variables in an Expression Rule, are shown in the "Local Variables" section after the rule has been run with Test inputs (if needed).
Mike Schmitt and Shubham Aware already explained different ways of debugging.
In addition, If you want to print local variable value in logs, you can try logmessage plug-in (community.appian.com/.../log-a-message).
a!localVariables( local!data: "Message printed by logmessage function..........", local!info: logmessage("ERROR", local!data), local!data )
Output:
The following will be printed in tomcat-stdOut.log file:2024-06-11 07:24:30,614 [http-nio-8080-exec-995] ERROR com.incessant.plugins.logMessageMain.LogMessage - Message printed by logmessage function..........
I hope this helps.