LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Filling data to specific column in table control from array

Solved!
Go to solution
Solution
Accepted by topic author TeddyLu

Hi Teddy,

 

what's the matter with you?

Why do you still use lots of local variables and sequence frames - despite getting suggestions to not use them?

Why do you still set the index of an array constant to 100 - despite being told it's senseless?

 

That's your VI after cleaning up:

check.png

 

The information is being added was appended to the bottom last used row in the programmatic table instead of the last used column

Because you have it programmed that way!

Do you see that InsertIntoArray you use to insert the "manual input table"? Do you see its set to insert by rows as the first "row" index input is a full black rectangle while the 2nd "column" index input is an open rectangle?

When you want to insert by columns you need to do and wire exactly that!

 

As Altenbach says: InsertIntoArray most often is the wrong tool!

Why do you initialize your array to 20 columns? When you want to replace elements in your array you should actually replace them, but not insert them! Use ReplaceArrayElements to put your "manual input" at the right place…

Best regards,
GerdW


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

Hi GerdW,

I do apologize, coming from a syntax coding background. Variables have been my go to thing for my coding structures. I guess I'll have to break out of that habit. I did read that direct wiring is better suited due to race conditions (I have yet to see an example of that, but I feel it might be taught in the first course for Labview)

 

Thank you for the insights so far. I'll definitely keep them in mind for future projects. 

0 Kudos
Message 12 of 19
(2,007 Views)

So I've tried using replaceArrayelements to get my manual input table to the right location of my programmatic table but I'm getting a table mismatch connection error. 

 

Is it due to the fact that one has headers and in addition is numerical vs. the other which is full of strings?

0 Kudos
Message 13 of 19
(2,002 Views)

A table is always strings. You can format your numerics to make the compatible.

 

Did you even look at the example I attached earlier? It has all the tools you possibly need. even shows the formatting!

0 Kudos
Message 14 of 19
(1,998 Views)

Hrmm. Okay so my manual input table is full of strings, but I'm still getting a table mismatch error, and I have no clue what format function I should use or if that's even the case for the error...

 

0 Kudos
Message 15 of 19
(1,992 Views)

If you attach a new VI, please also give it a new name to avoid confusion. I'll have a look.

0 Kudos
Message 16 of 19
(1,990 Views)

If you need to replace part of a 2D array with a 2D array, you need to wire both indices to avoid ambiguity.

Message 17 of 19
(1,989 Views)

Thank you altenbach,

I didn't want to spam your download list with different VI's with different names. I'll submit myself to the classes for the basics.

 

I appreciate all the help given.

0 Kudos
Message 18 of 19
(1,984 Views)



TeddyLu wrote:

I didn't want to spam your download list with different VI's with different names. en.

The problem is that my "downloads" folder now has multiple VIs, all with the same name and numbered in the order of downloads (not necessarily in the order posted). The number of files is the same, but with unique names they are easier to track and cross-reference to the related post. To make sure I am looking at the right VI, I might to even have to download it again, making the problem more serious. (The problem gets worse with subVIs, for example if there is an older subVI with the same name (e.g. untiltled 1.vi) and new VIs (caller and sub) are posted, the new untitled 1.vi will be renamed by the browser to untitled 1(1).vi and the caller will try to load the old, unrelated VI, breaking everything in the process. Yes, happens all the time!)

 

0 Kudos
Message 19 of 19
(1,980 Views)