06-21-2018 07:10 AM
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
06-21-2018 07:23 AM
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?
06-21-2018 07:54 AM
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"
06-21-2018 08:09 AM
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…
06-21-2018 08:29 AM
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
06-21-2018 08:56 AM
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…
06-21-2018 09:33 AM
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 !
06-21-2018 09:48 AM