LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Database - Automatic value

Solved!
Go to solution

Hello, so I have a table with 15 Columns, and my 1st Column is complete automatically by the Database. How can I say to the program "Don't touch to the 1st column" or something like that? Blank or Void are not ok. probably need something that never exec without a "start" value... I don't know, any help would be great, thanks.

0 Kudos
Message 1 of 13
(4,684 Views)
In your SQL don't include it in the list of columns into which you are inserting data. The same applies for any field with a default value assigned to it that you don't want to overwrite.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

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

For help with grief and grieving.
Message 2 of 13
(4,681 Views)

Hello,

 

Thanks for your answer, so LabVIEW can not interact only with the 2nd to 15th column? It will everytime interact with every columns in the table? So if my company want to add so field indepently of the tests generate by LabVIEW it is not possible?

 

The problem is that my company want a Table with: Id, Computername, Username, Measure Name, Measure Value, Measure Unit...

And Id is a default value that they want to see in the table... I can not

 

Here is an excel picture to see you how will look the table that I have to create. And the Id column is, has a default value but need to be in the table. Is it possible with LabVIEW?

0 Kudos
Message 3 of 13
(4,677 Views)

LabVIEW will interact with whatever columns you tell it to. Don't tell it to insert data into the first column.

This isn't a LabVIEW question, it's very basic SQL. You will need to generate an insert statement like:

insert into myTable
(AssembyPN, SerialNumber, ComputerName, the remaining 11 column names)
values
(1234,'ABC00001','toto_pc', the remaining 11 column values)
;

Id is not included in the column list so it is not effected.

Mike...

PS: The company's database design stinks on ice, but that is a different conversation...


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 4 of 13
(4,671 Views)

Ok thanks for your answer, now I understand where is the problem but I am looking for a last question:

 

If I do:

 

INSERT INTO TESTS.STEP1.POWERSUPPLIES(The 14 last column names)

VALUES(' ',' ',' ',' ',' ')

 

Is LabVIEW going to erase spaces and then write the right values into the table?

 

I am sorry, I am in internship and I never worked on Databases, only on LabVIEW so that's not me who do the SQL code...

 

If LabVIEW is going to erase spaces and then write the right values in the table, then I will ask them to add that 2 lines.

0 Kudos
Message 5 of 13
(4,660 Views)

Also, is there anyway to insert that 2 lines with Excel Query Editor? Then I could make it alone...

0 Kudos
Message 6 of 13
(4,658 Views)
Solution
Accepted by topic author Robinm76
Again, LabVIEW only does what you tell it to do. You need to build the string that has the correct data in the correct place. Going back to what I posted before I would parameterize the insert by changing the clause:

values
(1234,'ABC00001','toto_pc', the remaining 11 column values)

To something like:

values
(%d,'%s','%s', the remaining 11 column values)

I would then use format to string to insert the data.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

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

For help with grief and grieving.
Message 7 of 13
(4,654 Views)

Ok, thanks for your answers. It will probably work when it will be fixed. We will try like it.

 

Thanks for all,

Robin.

0 Kudos
Message 8 of 13
(4,638 Views)

Hello,

 

Here is a screenshot, but the problem stay the same...

 

Have you some good document to learn SQL Server code to communicate with LabVIEW? The guys that have to do it are busy so I am trying to do it my self...

0 Kudos
Message 9 of 13
(4,553 Views)
You need LabVIEW code that uses that format to string function to insert the real data into the string at the places where the format codes occur.

For the LabVIEW part you need to take some time and work through some of the online tutorials. To help you learn databases here is a link to the first of a series of articles that I wrote on the topic:

http://www.notatamelion.com/2015/01/05/managing-data-the-easy-way/

I understand that you are an intern and that right now you are feeling like you have been cut adrift in a sea of things you don't know. However one advantage you have is that you have time to sort this out but it will require you to spend a lot of time during work - and after hours as well - learning.

You have never mentioned what your internship is in, but when you are offered an opportunity even slightly relayed to you field, ALWAYS say yes, and then study like crazy to learn what you need to know to do the job. If you are not married, this will be a lot easier. If you are married, and your spouse complains about the time, remind them that they are married to an engineer. If they wanted regular hours, they should have married someone who flips burgers at MacDonald's.

Assuming your name is "Robin" and not just your favorite bird, you could be a man or woman, I have had friends with that name who were both. The point is that the rules are basically the same regardless. It is true that in many (most?) parts of the world women need to be twice as good as men to get the same amount of credit. This is wrong and unfair - but it is also reality. However the reality is changing. One good thing that can come from it however is that if you have to do twice as much, you will also gain twice the experience and twice the wisdom, so when people do start getting judged on their merits and not their gender, skin color, age, religion, etc. guess who is going to come out on top?

Finally, feel free to ignore the nontechnical bloviating of this old man.

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 10 of 13
(4,538 Views)