I'm Newbie to ThingWorx.
Kindly help me to Write JS service or Query service to fetch data from two or more Database tables as table or grid.
Thanks all in advance.
You can learn how to query data and write data to external databases.
You would need to enable a connection between ThingWorx and your database of choice:
1. Ensure the user you created has read, write, and execute permissions. If you would rather split roles, you can create multiple users to handle each aspect. The execute permission for stored procedures is not necessary.
2. Download the database driver/.jar file and move it to the lib directory of the Tomcat installation (ie, /lib).
3. Restart the Tomcat server to load the JDBC driver to make it available for the ThingWorx web application.
It is needed to add the .jar file for the database to the lib folder of the Tomcat folder and set up the connection in the ThingWorx Platform.
To create a connection and begin working with an external database, you will need to create a database Thing and set up the connection string and credentials.
You will enter the class name of your driver, the connection string for that database connection, and the credentials to access the database.
You can check the following guide Working with External Databases for more details. You can check step 3 Query Data from External Database to see a provided example.
Hope it helps,
Thanks for the reply.i'm looking for script examples like
row_number() over ( order by A.pdi_engine_number) as "SNO",A.pdi_engine_number as "ENGINE NUMBER", C.shift as "Shift",
A.pdi_no as "PDI Station",A.emp_id as "USER ID",A.pdi_timestamp as "OK Time & Date",
A.pdi_station_ststus as "Status",B.status as "Status",
A.leak_value as "Leak Value",A.pdi_timestamp as "Not OK Date",B.rejected_reason as "Reworks Problem",
B.other_rejected_reason as "Reworks Group",A.emp_id as "NotOk User ID"
from pdi_hcd A, rework_data B , mainline_hcd C //--three tables from Database with alias A,B,C