LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extracting just the first value from a 2d string array with data from sql

Solved!
Go to solution

Hi, i am selecting some data from mysql and putting them into a 2d string array. For my diploma project, i am trying to extract from that array just the first value because i am refreshing the array always ( deleting them at the end of the application, pressing a button and it's refreshed). I have tried everything, using a duplicate, using the reference of the table and it's not working.

here you can find some screenshots . could you guys help me because i m kind of blocked here and i need to present my project xD

mihai_badea_0-1592465183919.png

mihai_badea_1-1592465193655.png

 

just the first column is populated. i have no experience with labview, but i need to simulate something using labview and codesys, the connection been made using OPC. thanks guys

0 Kudos
Message 1 of 7
(2,937 Views)

Hi mihai,

 


@mihai_badea wrote:

i am trying to extract from that array just the first value because i am refreshing the array always ( deleting them at the end of the application, pressing a button and it's refreshed). I have tried everything, using a duplicate, using the reference of the table and it's not working.
just the first column is populated. i have no experience with labview,


Simple basic LabVIEW: to index an element from an array you should use the IndexArray function…

 

When you want/need to use LabVIEW you should learn the basics first: there is a "Training resources" section right in the header of the LabVIEW board. And NI also offers the online self-paced courses for free right now, so you could immediatly start with "LabVIEW Core 1" training!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,930 Views)

Hi, i have tried using the indexarray, but it's not working when it comes to the reference. after duplicating the array, it was working, but i need to use it as a reference so that it updates while running the app.

 

also, i have watched the tutorials 

0 Kudos
Message 3 of 7
(2,927 Views)

Hi mihai,

 


@mihai_badea wrote:

Hi, i have tried using the indexarray, but it's not working when it comes to the reference. after duplicating the array, it was working, but i need to use it as a reference so that it updates while running the app.


???

Why do you need any references to "update it while running the app"?

(To update an indicator you just need to use a loop and write more than once to that indicator…)

 

Why do you need to "duplicate" an array indicator when you just need to use a wire?

 

Simple like that:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(2,922 Views)

hi, thanks a lot of the replies and the pieces of advice provided, 

i need to use the reference because i am extracting data from my database ( SQL ) using select, and in my main program, I call the sql function everytime i press a button. Long story short, but i am trying to accomplish here is to simulate the returning of a book automatically using codesys and i need to extract a code ( ISBN CODE for the book) in order to update my sql using delete, insert update etc.

As you can see in the screenshot below, i dont know why, but it's not working, as you can see bellow

trying to replicate my array : 

mihai_badea_0-1592467173604.png

 that s what i have done before posting

trying to use the reference ; 

mihai_badea_1-1592467219253.png

 

0 Kudos
Message 5 of 7
(2,906 Views)
Solution
Accepted by topic author mihai_badea

Hi mihai,

 


@mihai_badea wrote:

i need to use the reference because i am extracting data from my database ( SQL ) using select, and in my main program, I call the sql function everytime i press a button. Long story short, but i am trying to accomplish here is to simulate the returning of a book automatically using codesys and i need to extract a code ( ISBN CODE for the book) in order to update my sql using delete, insert update etc.


I still don't see a use case for using references here.

You read data from SQL database: use the data you got and apply IndexArray on it!

 


@mihai_badea wrote:

As you can see in the screenshot below, i dont know why, but it's not working
trying to use the reference ; 

mihai_badea_1-1592467219253.png


As you already took some courses (did you?) you know the purpose of control references. A reference is like a pointer to a control, but it is NOT the value of that control!

 

LabVIEW comes with a huge example library, and there are examples explaining how to use references!

  • Basically you need to use a property to read the value of the control referenced by that reference.
  • Generally it is a bad idea to use references when a simple wire would work too…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 7
(2,882 Views)

thank you very much, using the property worked perfectly for me, appreciate your efforts trying to help me 🙂 thank you again

0 Kudos
Message 7 of 7
(2,862 Views)