02-21-2024 10:59 AM
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
Solved! Go to Solution.
02-21-2024 11:15 AM - edited 02-21-2024 11:17 AM
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....
02-22-2024 06:27 AM
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.
02-22-2024 09:19 AM
02-22-2024 11:07 AM
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?
02-22-2024 01:36 PM
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?
02-22-2024 03:15 PM
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".
02-23-2024 07:41 AM
Muito obrigado pela explicação rotake vou fazer isso que falou e retorno aqui.
Agradecido
02-23-2024 09:31 AM
@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. 🙂
02-27-2024 10:05 AM
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.