LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview crashes with Excel ActiveX

Dear all,
I have written a program to read and write the data in the excel using ActiveX sheet but crashes the Labview drastically when executed.

Please go through the attached files.


Actually the program has to sort the data in ascending order in a column in a
Specified worksheet and it should write the sorted data in another worksheet in the same excel file itself. But while writing it should neglect the repeating data and should write the corresponding data in the other column with respect to sorted one.

For example , In datafile.xls in sheet1 cells are like below. Let a, b & g are columns

a1=0.02, b1=2.1 , g1=0.1
a2=0.04, b2=4.2 , g2=0.3
a3=0.05, b3=4.2 , g3=0.35
a4=0.06, b4=4.3
, g4=0.43
a5=0.07, b5=7.1 , g5=0.43
a6=0.08, b6=7.2 , g6=0.43
a7=0.09, b7=7.2 , g7=0.75
a8=0.11, b8=7.4 , g8=0.75
.
.
.
.

Here, I want to sort the column b the repetition in b3&b7 should be neglected along with corresponding data in column a and g

In sheet2 the following should appear

a1=0.02, b1=2.1 , g1=0.1
a2=0.04, b2=4.2 , g2=0.3
a4=0.06, b4=4.3 , g4=0.43
a5=0.07, b5=7.1 , g5=0.43
a6=0.08, b6=7.2 , g6=0.43
a8=0.11, b8=7.4 , g8=0.75

Any solution will be greatly appreciated. Looking forward for some help.

Prasath.
Prasath M,
Emmeskay Systems Solutions Pvt. Ltd.
No: 20, Kannadasan Salai,
Chennai - 600 017.
mprasath@hotmail.com
Download All
0 Kudos
Message 1 of 7
(3,698 Views)
I have five suggestions for you.

First, eliminate duplicate references to WorkSheet2. This should be created outside the for loop and closed after the loop is completed.

Second, do not allow ActiveX calls in parallel. Wire the error cluster of all calls to force this. Currently the 3 case statements operate in parallel on the same sheet. This is not a hard requirement, but simplifies debugging problems.

Third, close all references when they are no longer needed. You create four references for the Range->Value2 for each iteration of the loop, but only close the last one outside the loop.

Fourth, do not close the same referece more than once. Your create a referece to Sheet1 outsite the loop (good), but you close it 4 times after
the loop (bad). What comes out of the top right terminal of the property and invoke nodes is the same as what when in on the top left.

Fifth, do not close a reference until you are done with it. You bring into the loop a reference for Sheets, but close it inside all three case statements. This will cause an error on the next iteration when you try to use it again.

Michael Munroe
www.abcdef.biz
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
Message 2 of 7
(3,698 Views)
Dear Michael,
Thank you very much for your valuable suggestions. I hope that I can debug my program as per your suggestions. Thanks a lot.

Prasath.
Prasath M,
Emmeskay Systems Solutions Pvt. Ltd.
No: 20, Kannadasan Salai,
Chennai - 600 017.
mprasath@hotmail.com
0 Kudos
Message 3 of 7
(3,698 Views)
Dear Micheal,
I have corrected my program as you said for my understanding. Now, labview crashing has stopped. But it says some " incorrect function" error.
My all attempts fails to solve this error.
Can you please check the attached file ?
I am sorry if I disturb you much...

Looking forward for your comment.

Prasath.
Prasath M,
Emmeskay Systems Solutions Pvt. Ltd.
No: 20, Kannadasan Salai,
Chennai - 600 017.
mprasath@hotmail.com
0 Kudos
Message 4 of 7
(3,698 Views)
I made some quick edits to your VI and some notes on the diagram. It is important that the ref that exits the top right terminal of the invoke and property nodes not be closed inside the loop. It is the same ref as the top left terminal and is needed for the next iteration.

I also moved the Sheets->Item(sheet2) outside the loop so that the worksheet reference is created only once. I also closed it only after the loop completes.

Michael
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 5 of 7
(3,698 Views)
Dear Michael,
Again, the labview crashes when I run the program. Initially, it was executed succesfully when iteration value (N) was 5. When I repeat the same program the windows said that "program error" and Labview crashed down.
can you please tell me what is the problem?
Thanks for continuing your help..

Prasath
Prasath M,
Emmeskay Systems Solutions Pvt. Ltd.
No: 20, Kannadasan Salai,
Chennai - 600 017.
mprasath@hotmail.com
0 Kudos
Message 6 of 7
(3,698 Views)
Hi Prasath,

Sorry, my last modification was closing the Sheet2 ref inside the loop. Try this mod.

Michael Munroe
Prasath M,
Emmeskay Systems Solutions Pvt. Ltd.
No: 20, Kannadasan Salai,
Chennai - 600 017.
mprasath@hotmail.com
0 Kudos
Message 7 of 7
(3,698 Views)