LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Report Generation for Microsoft Office - Using Table Functions in For Loops

Solved!
Go to solution

I'm currently trying to create a vi to add rows to a table based on the amount of data I'm trying to print to the table. The problem I'm running into is passing the for loop constant 'i' into the 'add row' and 'edit cell' sub vi's. I can create a constant or control for the (row, column) parameter, but can't unbundle and rebundle the constant/control to include the 'i' for the row number. Anyone have any ideas how to manipulate this?forloop.PNG

Passing 'i' into the first integer block in the (0,0) cluster

0 Kudos
Message 1 of 4
(2,104 Views)
Solution
Accepted by topic author reesl

Create the constant, delete the wire, add "Bundle By Name", wire the constant to the input, select "Row", wire i to Row.

Message 2 of 4
(2,088 Views)

Well, I often tell my colleagues who ask me for LabVIEW advice "What are you trying to do?".  They then proceed to tell me How they are trying to accomplish their goal.

 

It sounds to me that possibly "What" you want to do is to insert a 2D Array of data (with N rows and who-knows-how-many-columns) into (and probably at the end) of an Excel page.  I've done this often, and use Excel Easy Table to do this.

 

If you had attached your VI (instead of a static picture of a tiny part of your code), I could have verified this and made a more informed recommendation.  Doing the addition "all at once" is defiinitely easier to write and much easier to read and understand than doing it one cell at a time ...

 

If you want more advice (from me), attach your VI.

 

Bob Schor

0 Kudos
Message 3 of 4
(2,070 Views)

Just to emphasise Bob's point:

 

If "What" you want to do is to insert a number of consecutive empty rows that may (or may not) be filled with data at some later point, you can use the ActiveX Range.Insert method to do them all at once rather than having to use a loop.  There's a little more code involved but it may be quicker, particularly for a large number of rows.

0 Kudos
Message 4 of 4
(2,049 Views)