LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

web based application

Hi meysam_b

 

"I'm so sad for it because I love Labview and I hoped that labvew help me stand alone in web based application."

 

Don't be sad!  Smiley Happy I developed the LabSocket system for situations just like yours.  LabSocket automatically creates a web page from a LabVIEW front panel and then synchronizes the controls and indicators in the front panel and browser.  Since the system does not require browser plug-ins or client-side run-time engine, LabVIEW applications can be accessed from any modern browser, including those on mobile devices.

 

A nice example of the ease-of-use of the system is a Home Automation system developed by 4th year engineering students at the British University in Egypt. Details of their project (Final Report, video, etc) are posted in the LabSocket User Group forum on LinkedIn: http://lnkd.in/bnHxWzi

 

To get started with the system, I'd recommend trying out the fully functional downloadable demo package.  The demo and user guide for the system are available at: http://labsocket.com/download.html.

 

You're welcome to contact me directly at jbergmans <at> bergmans <dot> com if you have any questions about the system.

 

Regards,

 

John Bergmans

See you NIWeek 2014

0 Kudos
Message 11 of 29
(1,308 Views)

Hi!

 

Sorry to post my question here, but I'm having a similar issue developing a web version of my labview application in HTML.

 

I want my web version to be the interface layer that shows some of the most important stuff that my labview application does. And for that I'm trying to use the labview's web services. My problem is that my application also uses a MySQL database, and if I make a simple query on a labview's web method VI, it doesn't work. I know that I can access the database with PHP in a HTML page, but I really don't have enough time to implement again in PHP everything I have on my labview application that accesses the database.

 

Is database connectivity not possible in labview's web method VIs? I was trying a simple query in the web method VI to test it and it didn't work. I've also tried putting the query in a subVI that the web method VI calls, but it didn't work either...

 

I'm using Labview 2013 with Database Connectivity Toolkit.

0 Kudos
Message 12 of 29
(1,264 Views)
What do you mean when you say it doesn't work? Error messages? No data/wrong data returned?

If it is all running on the same computer -- and you have the right ADO drivers -- you should in theory be able to access mySQL directly.

I have seen problems in the past (LV 2011-2012 time frame) where accessing a database directly from a web service caused problems. In this case it was, for lack of a better term, a CPU leak. To verify the problem I created a very simple service that performed a very simple query. What I observed was that over time the query took larger and larger chunks of CPU load while never actually returning any more data, or using any more memory.

I was able to demonstrate the problem to NI but was told that there was nothing that could be done to track the problem because, "...you can't debug VIs in a web service."

Which is but one more reason why I don't use or recommend web services.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 13 of 29
(1,261 Views)

It doesn't return any data or returns 0. Shared variables or simple stuff works fine on the web method VI. I only noticed that database queries don't work correctly. But on normal VIs in my labview application I dont't have any kind of issues accessing the database.

 

I've attached screenshots of the web method VI and the result. With that query it should've returned 323.

Download All
0 Kudos
Message 14 of 29
(1,251 Views)
I hear what you are saying about not having time to rewrite to use PHP, but the fact that you are using the DCT might actually help you. Consider this: Because you are using the DCT the interface you have to your DB right now is already highly parameterized. By that I mean you don't use SQL to perform queries but instead specify as separate parameters the table name, the desired columns and any conditionals (the stuff for the WHERE clause).

You could write a parameterized PHP script that could handle any query based on these same parameters and return the data as a json string. JSON because it is very easy (perhaps even automatic) to parse into a native LV data structures.

You would then create a VI to call that script that would be a dropin replacement for the DCT query VI.

The result would be to significantly reduce the number of modifications to the existing code. You do have all your DB access logic encapsulated in subVIs, right?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 15 of 29
(1,239 Views)

I'm not sure I understand correctly what you are suggesting.

 

Are you saying that I could use the same query parameters I use on my VIs for accessing the DB on a PHP script that I would call on labview, returning the data in JSON and then parsing it to labview data structures? And then my web application would call a web method that accesses that data?

 

That's very interesting, but since I haven't done anything like it and this is the first time I'm trying to develop a web application based on labview, I don't know if I could do what I want on time...

 

But the problem I'm having with database connectivity not working with web methods VIs it's a limitation on labview? Or could it be something I don't have properly configured?

0 Kudos
Message 16 of 29
(1,229 Views)

Frankly, I don't know what the most likely problem would be and as far as I know, you still can't debug a web service.

 

But, yes you seemed to grasp my idea exactly. 

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 17 of 29
(1,208 Views)

You've always been able to debug web services, it was just previously in a separate context, making it like debugging an exe... which was no fun. Now you can launch the web service in a debug context, making it debuggable as if it is a normal VI.

 

The CPU usage issue was fixed in 2012 I think, and it was with any open reference item - shared variable , TCP, whatever.

 

 

 

Back to the original question. It sounds like it would be easy to just run the Vi as-is and see what data comes back. Can you post a picture of that same Vi with the front panel showing your expected value?

If you still get 0, it is something in your code. If you get data but it still doesn't work in the web service, wire up your errors and figure out what is being thrown, because undoubtedly something is but you just don't know it. 

0 Kudos
Message 18 of 29
(1,197 Views)

My VI is a simple query. Nothing special about it. I've attached screen shots of the VI and front panel with the expected result and the web method VI with the xml output in the browser. It doesn't show any errors.

 

My doubt is if there's something I should do differently when using the Database Connectivity Toolkit in web method VIs. Or if it isn't supported in web method VIs.

0 Kudos
Message 19 of 29
(1,170 Views)

@dems wrote:

You've always been able to debug web services, it was just previously in a separate context, making it like debugging an exe... which was no fun. Now you can launch the web service in a debug context, making it debuggable as if it is a normal VI.

 

The CPU usage issue was fixed in 2012 I think, and it was with any open reference item - shared variable , TCP, whatever.

 


Gee I wish I had talked to you when I ran into the problem. Not knowing any better I thought NI's Premier Support and LV development team would know what was going on. Guess not...

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 20 of 29
(1,160 Views)