LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

updating values of excel data in each run time

 Hello!

 

I'm calling excel file into LV to read values of each worksheet, using active X, but everytime I run the code, the values in " data sheet" are not freshed/ updated,  i'm left with the data from the last run, and even when I change the file to get data from, the values of "select a sheet" which contains " sheets name",  are not displayed until the second run, 

Please, you will find attached the VI of reading excel data , any idea how to solve this issue

Thank you

 

 

0 Kudos
Message 1 of 8
(2,419 Views)

Hi Student,

 

the values in " data sheet" are not freshed/ updated,  i'm left with the data from the last run

When closing the Workbook you wired FALSE to "Save changes"…

 

Do you really need an user event (and an additional loop) to react on a STOP button???

Do you really need the loop around the event structure when that loop is exited right after the very first iteration?

Best regards,
GerdW


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

Hello

 

I wired FALSE to "Save changes" property node because I don't want changes to be saved if any modification happened to the excel file ( the XLS file called must not be touched) 

I used Event function with dynamic events enabled to trigger Read values of the selected sheet, but even when i delete the event structure and the while loop around it to make the code simlper, and replace them with a condition structure, with the boolean " sheet validation " as a selector, i get nothing in return, please see below the modification.

I want, after selecting one sheet from the list and pressing " sheet validation ", the sheet data will be displayed in the array "sheet data" 

0 Kudos
Message 3 of 8
(2,397 Views)

Hi Student,

 

I want, after selecting one sheet from the list and pressing " sheet validation ", the sheet data will be displayed in the array "sheet data"

THINK DATAFLOW! Beware of race conditions!

Your combobox is (most probably) read before you even set the sheet names in the combobox. You need to wait for user input AFTER you initialized that combobox with the sheetnames.

 

Easy to solve using an event structure waiting for a value change event of that combobox…

Best regards,
GerdW


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

I tried what you suggested for me, using an event structure waiting for a value change of the combobox " select a sheet", but I always get the same original issue : left with the data sheet of the last run !! 

It's most probably a race condition as you said but I didn't find a  way to make it respect the dataflow !

PS : this subVI will be called in the main VI to make the user select the sheet and get data

0 Kudos
Message 5 of 8
(2,382 Views)

Hi Student,

 

It's most probably a race condition as you said but I didn't find a  way to make it respect the dataflow !

Yes.

You still read the combobox value BEFORE the event structure, but you need to read it IN the event structure…

Best regards,
GerdW


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

Hello

thank you for your reply, using the combox IN the event structure solved the issue, still, regarding the boolean " sheet validation", How shall i wire it, to assure that if pressed, i can pass to the event to get data ?

I add a condition structure around the event to execute the event if " sheet validation" is TRUE, but it doen't work and I need to put this boolean, because i need to call it in the main ! 

0 Kudos
Message 7 of 8
(2,365 Views)

Hi Student,

 

you can configure one event case to be called on several events, like "combobox value change" and "button value change"…

Best regards,
GerdW


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