How to get data from database in html page created in web dev module

#3

Consider going through the free online training so you’ll get an overview of what’s possible and how things work.

2 Likes

#5

We have developed a RWS (Web Services) module for Ignition, that allows you to pull any data from Ignition server using WebDev module in an HTML page in JSON format. Once you have the data source available in the HTML page , you can use it to drive any HTML/DOM component. We can easily modify it to get Data from a Database as a json object. We are coming out with the next version 1.5 to have this request/response feature soon. Present version 1.4 is available on EXCHANGE portal at https://inductiveautomation.com/exchange/1954/overview

1 Like

#6

I did as given in the github instructions(“https://github.com/PRAMANJ/ARSCADA-1.4”) but I am getting 404 error

0 Likes

#7

sorry for the late response, it was midnight when I signed off yesterday. The download and instructions are also available on Exchange portal https://inductiveautomation.com/exchange/1954/installation. On step 13, you need to replace the host name pramanj to your server’s host name in the URL http: //pramanj:8088/main/system/webdev/ars/ARS/rws/rws1.html. Sorry I forgot to mention it here, though I have mentioned it in ARSCADA instructions in step 10 on this page. To get your host name type hostname and press enter on command prompt.

I will upload the revised version 1.5 soon with request/response structure so that you can get database values as well on the HTML client.

0 Likes

#8

No problem for the late response and thank you for your time. I tried as you told but still getting the same error 404. I also tried calling postjson file in the web dev and its working but when try calling ARS/systemlist.html its giving 404 error.

0 Likes

#9

Strange! try following things:

  1. The default project name “ars” (lower case) in URL http: //pramanj:8088/main/system/webdev/ars/ARS/systemlist.html is case sensitive.Have you named your project as ARS or ars? Change the project name or URL accordingly.
  2. The project name in c:\ARS\viewer\embedhost.js is also case sensitive. Ensure its in line with your project name given.
  3. Hope you have saved the project after importing the appropriate demo project , depending upon the Ignition version your are trying with.(b.t.w which version of Ignition are your trying with? 7.9 or 8?).
  4. Hope you have imported the tags.xml file in default tag provider in the ars project.
  5. Just make sure the file C:\ARS\systemlist.html exists in the path.

Let me know if it works with these changes

regards:

1 Like

#10
  1. My project name is “ars”
  2. The project name in c:\ARS\viewer\embedhost.js is also “ars”
  3. I saved my project after importing and my ignition version is 8.0.7
  4. Imported Tags too
  5. C:\ARS\systemlist.html it exists in the path and i tried opening it outside of ignition and it was opening.
    And I used Host name after checking the hostname in cmd
    In the URL instead of pramanj I tried using hostname then its showing " This site can’t be reached" and I changed it with localhost ip then getting 404 error page not found.
0 Likes

#11

I will install version 8.0.7 and try . I have an older version

1 Like

#12

Hope a file resource with path C:\ARS is mounted on your webdev node on project browser? If not then right click in webdev and mount folder and select path. Also use hostname instead of localhost in the URL.

0 Likes

#13

Yep, I have C:\ARS is mounted on my webdev node. And when I use hostname its giving an error " This site can’t be reached"

0 Likes

#14

Any ignition webdev experts may like to throw some light, what could be going wrong ? I have enabled CORS

0 Likes

#15

Could be some proxy setting issue? Which browser are you using? Chrome? Some google search may give the solution perhaps!

0 Likes

#16

I am using chrome.

0 Likes

#17

Is it working for you after installing ignition 8.0.7?

0 Likes

#18

I just upgraded my Ignition trial version to 8.0.7 (it upgraded smoothly!) and my ARS module is running like a champ! I think its got something to do with your proxy setting! Do a google search for “This site can’t be reached” you may get a lot of tips for the likely cause. Being on the local machine, I think it can only be a proxy setting issue, it can’t be a network issue.

Try to open the URL in a different browser like IE or Edge or firefox?

0 Likes

#19

See the main page for the URL

0 Likes

#20

As mentioned earlier , yes it’s working fine on 8.0.7. Did you try on different browser or proxy settings? Will appreciate your feedback . I am coming out with slightly revised version 1.5 of ARSCADA soon

0 Likes

#21

I tried with google chrome and edge still it didn’t work.

0 Likes

#22

Do a google search for “This site can’t be reached” you may get a lot of tips for the likely cause.

Can you also please send me a screen shot of your error with the URL visible

0 Likes

#23

Hopefully this is what you’re looking for:
I created a webdev Python resource:
image

	ds = system.dataset.toPyDataSet(system.dataset.toDataSet(["col1","col2","col3"],[['a','b','c'],['d','e','f'],['g','h','i'] ]))
	htmlText= "<html><body>"

	if len(ds)> 0:
		htmlText+= "<table><tr>"
		# set up the table header
		for colHdr in system.dataset.getColumnHeaders(ds):
			htmlText+= "<th>%s</th>"%(colHdr)
		htmlText+= "</tr>"
		
		#parse the dataset into an html structure
		for row in ds:
			htmlText+= "<tr>"
			for col in row:
				htmlText+="<td>%s</td>"%col
			htmlText+="</tr>"
		
		
		# done with the rows
		htmlText+="</table>"
	
	htmlText+="</body></html>"	
	return {'html': htmlText}

accessing the url: http://localhost:8088/system/webdev/projname/webdev_resource_name

results in a webpage:
image

0 Likes