09-14-2016 01:47 PM
I am trying to compare two excel workbooks in labview. Both have multiple worksheets, with different values in each cell. First I would need to see that the worksheet names match. Then I would have to check that the data in the first column matched before I could compare the row data. Does anyone know the best way to do this? I already have it so that it opens the two worksheets and reads in the data. I also have the report generator toolkit. If someone could help me that would be awesome.
09-14-2016 01:53 PM
Hi Kristen,
you should do exactly as you described it:
First I would need to see that the worksheet names match. Then I would have to check that the data in the first column matched before I could compare the row data.
Read the worksheet names, compare them.
Read first columns, compare them.
Read rows, compare them…
09-14-2016 01:56 PM
I am having problems with the reading the columns and comparing and reading the rows and comparing. Could you help me with the block diagram of this part? I am newer to Labview and don't know what to use.
09-14-2016 02:04 PM
09-14-2016 02:14 PM
By no means is this homework. I am just trying to find an easier way to compare 221+ sheet excel workbooks. Here is what I have so far, I don't know how to compare what is in the columns. If I use the search 1D Array VI it is searching for a particular thing, not checking to see if what I have from both worksheet column is equal.
09-14-2016 02:24 PM - edited 09-14-2016 02:25 PM
Hi Kristen,
you attached just an image instead of a VI or snippet. Should we debug your VI using Photoshop®???
Attach your VI!
Before attaching your VI you should say "THINK DATAFLOW!" with loud and clear voice!
Then remove the race conditions by replacing the local variables by wires and shift registers!
09-14-2016 02:34 PM
As much as I would love to fix what you told me to, I don't quite know how. Hence the reason why I came to this forum - for help. I have had no formal training in Labview and would love any help that you are willing to give. Attached is my VI.
09-14-2016 02:50 PM - edited 09-14-2016 03:10 PM
Read this page, it's basically "Dataflow 101" and is one of the most important things to know about LabVIEW.
Two specific things that were very easy to spot:
1. You have an error wire going backwards coming out of the top "Excel Get worksheet" VI
2. Both of your "Excel workbook properties" VIs feed out into a different local variable, and then in the middle those local variables are compared to each other. Because of the Dataflow rule, it's most likely that the comparison happens first, and then the worksheet names are put into the local variables. However, based on semi-random timing, sometimes one or the other or both will update before the comparison happens. If you just delete both of the "Worksheet name" local variables and wire directly from the "Excel workbook properties" VIs to the "Equals" node you are guaranteed that you'll always compare the most recent variables.
It might help you visually if before you run the VI, you open the block diagram and turn on "Highlight Execution" (the light bulb button) at the top so you can "see" dataflow in action in slow-mo.
09-14-2016 02:59 PM
I would also look into the State Machine architecture. I think this would fit perfectly for what you want to do.
09-14-2016 03:24 PM
I have made some changes, would you mind looking it over and see what else I can do to improve and make it work?