LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Como recuperar valores de um bundle

Solved!
Go to solution

Boa tarde. Sou novo utilizando o labview e estou tendo bastante dificuldade para pegar os valores que são passados para variaveis e salvar no banco. Conseguem me ajudar? falta so uma maneira de pegar esses valores e passar para a query.

Obrigado

 

RAFAELWILLIAN_1-1708534749088.png

 

0 Kudos
Message 1 of 11
(935 Views)

So you get three floating point values from three very poorly named global variables and you want put them into a database.

 

Your picture is insufficient to explain the problem, because we can't tell the datatype of the "output cluster" and we have no idea what toolkit your database functions(?) belong to. Are these homemade?

 

Attach your VI and point us to the help pages of your toolkit. Maybe we can help....

0 Kudos
Message 2 of 11
(926 Views)

Bom dia.

Me desculpe, é um teste estou apenas tentando aprender mas devia ter colocar um nome melhor nas variaveis haha..

 

Sim, são floats e a ferramenta de conexão com o banco estou utilizando que peguei neste blog www.halvorsen.blog. Não consegui utilizar a padrão do labview pois o odbc não gera o arquivo não sei se é por que é externo e utiliza mariadb então esse componente me da a opção de apenas informar o nome da variavel que configurei no odbc e conecta normal.

 

Se conseguir me auxiliar ficarei extremamente grato.

0 Kudos
Message 3 of 11
(877 Views)

The toolkit only has four VIs. There is no tool to send data to the database.

 

altenbach_0-1708615122601.png

 

0 Kudos
Message 4 of 11
(862 Views)

My SQL is very rusty, but wouldn't the 3rd one "SQL Execute.vi" be used with an INSERT statement to add data to the database?

0 Kudos
Message 5 of 11
(856 Views)

I can even insert it, but I can't get the values ​​from the bundle and pass it to the query. If I write an INSERT in data it records normally, but I don't know how to pass the variables from bundle. I learned how to use the database component from Labview itself. I only have a problem inserting it, but this time the error is that the number of columns is different from the parameters, but they are the same. everything is as a string because I was carrying out testing, I even put all the fields as varchar in database to clear up some doubts

 

can help me?

 

Download All
0 Kudos
Message 6 of 11
(842 Views)
Solution
Accepted by topic author RAFAELWILLIAN

Ola Rafael 

Q legal qu vc ta tentando aprender usar LabVIEW ! Se eu entendi sua pergunta, vc tem dados que vem como un cluster  e vc quer tirar esses dados e passar pro query ?

Se for isso, vc precisa transformar os dados em string e montar a query como string. A sua VI recebe um cluster composto de doubles ? Nesse caso vc tem que usar uma funcao "Unbundle by name" e transformar cada bundle em string. 

Se sua funcao recebe os doubles como variaveis globais (ninguem que programa em labview deveria usar variaveis globais, portanto evite ao maximo!) ai vc pode transformar os doubles em strings direetamente usando a funcao "Format Into string" ou usar as funcoes the Number/String Conversion. 

 

Pra montar a query de strings vc vai precisar usar as funcoes da pallete de strings "Concatenate Strings".

RKO
0 Kudos
Message 7 of 11
(824 Views)

Muito obrigado pela explicação rotake vou fazer isso que falou e retorno aqui.

 

Agradecido

0 Kudos
Message 8 of 11
(808 Views)

@Gregory wrote:

My SQL is very rusty, but wouldn't the 3rd one "SQL Execute.vi" be used with an INSERT statement to add data to the database?


I have never used SQL, but I don't understand why anyone would use some poorly documented toolkit from some random website if LabVIEW already has an official database connectivity toolkit. (And they even also give a link to an open source LabSQL toolkit). Seems like a more robust way to go. 😄

 

All we need to know is what the form of data databased accepts and solve the square-peg-round-hole problem. Can't be hard. 🙂

0 Kudos
Message 9 of 11
(802 Views)

Rotake muito obrigado consegui salvar no banco perfeitamente eu tinha feito como falou mas a partir do bundle desta forma consegui tbm e salvou. Muito obrigado.

RAFAELWILLIAN_0-1709049875879.png

 

Message 10 of 11
(751 Views)