Unclassified | Non classifié
The javascript calling a cgi-script may be the best option for us. Can javascript call a script locally on the server? Can anyone provide an example on how to call a local script from within Javascript.
Original Message:
Sent: 12/1/2025 6:43:00 AM
From: Michael Troitzsch
Subject: RE: Dash Webgui tool function
Hi Prem,
tools are either/or - you can't combine SQL and Javascript.
And given that the javascript-Tool runs in the user's browser, it doesn't have any access to the ObjectServer.
Not sure what you need to achieve - if you need javascript functions in the user's browser and want to modify the event, then one way I can think of is to launch a cgi-script from the javascript-Tool. The cgi then could modify the event via nco_sql. Not at all ideal, but would work.
If you just need to run different SQLs based on a variable x, consider adding the variable to the update's where clause (I'm using Severity instead of your x in the example):
update alerts.status set Location='%username' where Serial in ( $selected_rows.Serial ) and Severity < 3;
update alerts.status set Customer='%username' where Serial in ( $selected_rows.Serial ) and Severity >=3;
If you need the user to enter the "x" value you can even use a prompt to retrieve the info from the user.
HTH,
Michael
------------------------------
Michael Troitzsch
Solution Architect
DICOS GmbH
Darmstadt
------------------------------
Original Message:
Sent: Fri November 28, 2025 09:04 AM
From: Prem Sahota
Subject: Dash Webgui tool function
Hi, we have a requirement to create a tool that will invoke javascript but also need it to execute SQL as well. We cannot seem to get this to work.
Example
script(foreach="true",language="JavaScript")
{
some code
if (x=1) {
}
else {
sql(foreach="true",url="$(SERVER)/_tb37b/ael/Tool/Controller")
{
structure
{
text(data="update alerts.status set Location='")
variable(name="username")
text(data=");\u000d\n")
}
}
}
Any ideas on how we can get the above to work?
And once this is created manually, it can't be pulled in via the Dash Admin Tools function and edited because it will only save the SQL or Javascript part, depending on what tab is open when you click save.
------------------------------
Prem Sahota
------------------------------