5 Replies Latest reply: Sep 15, 2014 5:43 AM by Theo Klemming RSS

    Scrip Action(How to Actions)

    Sandeep Nayak



      I am using Data watch Desktop designer 12.2. I have the Standard work books present in that Designer.(Workbook name  :"How to Actions").

      In that workbook they explain how to use actions.I was able to see how to use Action URLs and use Actions for navigation.But New Script Action is not working. Script  is like ,







      alert('Selected Industries include: {ind:, }');


      But am Not seeing any action on executing these script


      Please help me

      1.Which language is compatible for scripting.

      2.and want to know how is that script processed.??



        • Re: Scrip Action(How to Actions)
          Theo Klemming

          Hi Sandeep


          The first thing that might be causing you trouble is that Script Actions will only work when you use your dashboard in a web browser. There is no javascript interpreter in Datawatch Desktop Designer, so it is incapable of executing any script actions. Therefore, you can try out your script actions only after publishing to a Datawatch server, and loading the dashboard in a browser.


          Second, the two things you list in your question, the window.open() and the alert(), cannot be part of the same script action. Typically, the script code you enter in the settings window of a script action should be a single-line statement or command, for example either the window.open() OR the alert().


          In any case where you need to run more complex scripts, the recommended setup is to write a function in javascript that you either make part of the web document that loads your Datawatch web client, or that is saved in a separate .js file which is referenced in said web document. Then, the script code in your script action would be a call to that function, providing the variable values expected by that function. And, those values can of course be Datawatch parameters. For example:




          I hope this information takes you across the hurdles.


          Best regards, Theo

            • Re: Scrip Action(How to Actions)
              Sandeep Nayak

              Hi Theo,


              Thanks for the Reply, it helped me ....

              Now my doubt is ..

                        I have written a .NET dll which would connect to my Database or Data source and Show the Table contents of that data source in Datawatch designer. Now I want to reverse the action - like i want to update or modify my data base/ data source from Datawatch designer dashboard.

              Reverse Path ...

              Is it possible ??

              Do you have Some samples/examples showing how to update Data source from Dashboard ??



                • Re: Scrip Action(How to Actions)
                  Theo Klemming

                  Hello Sandeep


                  What you want to achieve sounds like what we at Datawatch often refer to as "write-back".

                  Depending on if you want to use is the Designer stand-alone, or a web based dashboard provided from a Datawatch server, the approach is different.


                  The Designer stand-alone case:

                  The URL action functionality in Datawatch can be used for running local applications (exe) or batch script files (bat) or python scripts (py) etc. For example, to create a URL action that launches Notepad on your local system, simple specify notepad.exe as the URL or your URL action. Now, to grab data from your dashboard and write it to your database, you create a URL action with the necessary parameters, and some kind of executable or script that expects certain arguments, which will be your parameter values.


                  The Server-based dashboard case:

                  Here, you need one more step in the chain. Step 1 is to use a URL action. In step 2, you use a web document with server-side executed code (for example aspx, php) that you create. The URL you call in the URL action in step 1 should be this custom made web document of yours. As you call that document URL, with your parameters and values as request parameters appended to the URL, the code in the document must pick up those URL request parameters and their values, and then insert them to your database as you intended. Since that is server-side executed code, the database connection can be local. As an option to using a URL action, you may want to use a script action. That would allow you to use client-side javascript to pre-process / prepare the data given to the server-side code.


                  Best regards, Theo

                    • Re: Scrip Action(How to Actions)
                      Sandeep Nayak

                      Hello Theo,


                      Suppose I have a Dashboard with Table as its part.

                      1: I need to set/ change the value of a Table Column and Row.(Data is streamed from Data source With my .NETconnector DLL)

                      2: Once I change the Data in table it should be same as in Data source or Data base which am connecting.


                      How to do this No.1 : Any examples are available ?


                      Am using both Model you suggested

                      1.The Designer stand-alone case:

                      2.The Server-based dashboard case:


                      I need the Reverse path for updating data source.


                      Did this explanation helped in understanding my problem Sir ..??

                      Please help me Sir ..


                      Thank you .

                        • Re: Scrip Action(How to Actions)
                          Theo Klemming



                          When you write "reverse path", it makes me wonder if you expect that you would be able to write data to your data source via your own .NETconnector DLL?


                          What I can tell you is that no connnectors issued by Datawatch have this capability, i.e. the ability to WRITE data instead of reading.


                          I can only advice you to follow the model previously outlined:

                          For a Desktop Designer use case, you need to code an executable that picks up a value and writes it to your data source.

                          For a Server/web use case, you need to code a server-side executed web document that picks up a value and writes it to your data source.


                          Best regards, Theo