From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

advices for database application

hello,

 

We looked for exising solution to manage mesuremens and devices park without finding one that fit

maybe one of you know/use a good one !

 

so we are thinking about creating our own

 

in few month  i will have to develop a database application with postgre, this database will be used

to store devices mesurements, accuracy, drift , create alerts regarding calibration date,

printing calibration , verification certificates also stickers ....

 

Creating the dabase sould be ok, my question  is more regarding the langage to use to create interfaces

 

things to know:

 

- that i will not have any specifications or so few, this will be incrementals propositions

- I ' now quite comfortable with labview        

- php it surely the best way but i don't know any about it nether html ,css ...

- i could have a one week php course

- php is distributed application

- how to manage network shutdown with labview or php

- i will need to access an existing database an creating link with the new one 

- about 10 users can use the application 

- i don't have conection with web developper in my work circle

 

project is interesting , my anxiety with php could be to re write again and again , each time i will progress on this language

 

with labview i'm not sure that is the best way to create this type of application and to be forced a day or another to switch to php

 

If any advices don't hesitate

 

Tinnitus

 

 

CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 1 of 3
(2,595 Views)

I have been doing something like this for a while. I really do not like php but in all fairness I have not looked at it for several years. What I use is Python on the server through the Django web application framework running on Apache. It is very simple and easy to use.

 

The LabVIEW code writes data through http POST requests and the server inserts this data into the database. I do not use the Django object relational mapper. Instead I build the SQL inserts manually. I do this mostly because the database already exists and I just find it more natural.

 

I also do not make use of the Django template engine. The server returns XML to LabVIEW which looks something like this:

 

<Response>
 <Error>
  <Cluster>
   <Name>error in (no error)</Name>
   <NumElts>3</NumElts>
   <Boolean>
    <Name>status</Name>
    <Val>0</Val>
   </Boolean>
   <I32>
    <Name>code</Name>
    <Val>0</Val>
   </I32>
   <String>
    <Name>source</Name>
    <Val></Val>
   </String>
  </Cluster>
 </Error>
 <Data>
  <Cluster>
   <Name>Hello from server</Name>
   <NumElts>3</NumElts>
   <String>
    <Name>String</Name>
    <Val>Hello</Val>
   </String>
   <Boolean>
    <Name>Boolean</Name>
    <Val>1</Val>
   </Boolean>
   <DBL>
    <Name>Numeric</Name>
    <Val>42.00000000000000</Val>
   </DBL>
  </Cluster>
 </Data>
</Response>

 

Can you see what I am doing? I am returning an error and a cluster which can be unflattened using Unflatten From XML. I can set LabVIEW errors from Python for things like a request without the required parameters or whatever. I have a Python class that builds the XML Response which contains exactly two children - Error and Data. It has methods including createCluster, addLVObject, createLVArray, insertLVArrayElement, setError, etc. Finally it has a getXMLResponse method which returns the above XML string.

 

I return that using the Django HTTPResponse object and get at the data in LabVIEW like this

 

get xml response_BD.png

 

The returned cluster can be as complex as you want such as cluster of cluster of array of cluster. It always returns a cluster so if you want the server to return say an array then you will get a cluster containing an array that you simply unbundle. It supports strings, all the numeric representations, paths, visa resources, boolean and something i am forgetting at the moment.

 

Also my URL configuration is very simple since I only POST and do not send GET requests. This means I can map the URL directly to the Django view method of the same name. I get the parameters with request.POST.get('Parameter Name')

 

I know for a fact that you can do all of this with php but I just prefer Python. If none of the above makes sense then come back to it after you read about Django.

 

Good choice if it was a choice to use PostgreSQL or a stroke of good luck if it was not a choice. This is what I use and it has been rock solid for years. I really want to upgrade because the NOTIFY now supports data payloads. I have had to do some crazy things to get around the fact that the older versions do not support this.

 

I am thinking seriously about putting together a tutorial on this whole thing.

=====================
LabVIEW 2012


0 Kudos
Message 2 of 3
(2,583 Views)

I've always been on the other side of such an app, so just some limited advices. Normaly my measurement setup is writing files in an ascii format (e.g. csv). The database app will parse these measurement files. So one information I need to provide early in the project is all machine calibration files and measurement files that they need and the format (fields, columns) I use.

There are different ways to 'trigger' the parser, sometimes the other side gives the operators some interface so they do it manually, sometimes they periodically scan designated folders. Or they specify me a trigger mechanism such as a bus system or an xml ticket via TCP.

One advice several layers above: I've seen most home-grown implementations of such systems fail (turning into never ending chains of meetings). There are specialized companies that offer solutions for such systems with their tested frameworks.

 

Felix

0 Kudos
Message 3 of 3
(2,564 Views)