Hello,
I'm working on the GUI in CSS Phoebus where I have a macro that
specifies the IOC name (IOCname='llrf10'). All panels open from the
main one and the macro is inherited.
Instead of having the macro defined as a property of the main panel,
I'd like to have a text-entry field in the main panel where I'd set up
the IOC name.
I have an action button with a script (embeddedJs) which shall do the
job. However, the script gets stuck in the PVUtil getString call.
This is an excerpt of a simple script (just to check how to read a PV):
*************
var mypv = PVUtil.getString("llrf10:llrf:version");
logger.info(mypv);
*************
The error message:
*************
2020-09-02 11:02:46 WARNING [org.csstudio.display.builder.runtime]
Execution of 'JavaScript EmbeddedJs' failed
org.mozilla.javascript.EvaluatorException: Can't find method
org.csstudio.display.builder.runtime.script.PVUtil.getString(string).
(EmbeddedJs#14)
at
org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:79)
at
org.mozilla.javascript.Context.reportRuntimeError(Context.java:1011)
at
org.mozilla.javascript.Context.reportRuntimeError(Context.java:1064)
at
org.mozilla.javascript.Context.reportRuntimeError1(Context.java:1027)
at
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:145)
at
org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:45)
at org.mozilla.javascript.gen.EmbeddedJs_4._c_script_0(EmbeddedJs:14)
at org.mozilla.javascript.gen.EmbeddedJs_4.call(EmbeddedJs)
at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:412)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3545)
at org.mozilla.javascript.gen.EmbeddedJs_4.call(EmbeddedJs)
at org.mozilla.javascript.gen.EmbeddedJs_4.exec(EmbeddedJs)
at
org.csstudio.display.builder.runtime.script.internal.JavaScriptSupport.lambda$submit$0(JavaScriptSupport.java:84)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
*************
Could you advise the correct use of the PVUtil.getString function?
Finally, my text-entry field will have a 'loc://myname' PV which I
intend to read in the script and assign it to the "IOCname" macro.
Thanks,
Peter