Showing results for 
Search instead for 
Did you mean: 

Unnecesary wire bends?

Go to solution

Hi, today I was taking a CLD exam online, and i realized I wasn't that confident with ini files and the different structures these might have once the file is read.

I also noticed that in this case is not that easy to avoid bending wires but just to be sure I want to ask you guys what do you think about the style of this VI.


At the End it miight be a very ugly and non-scalable way to build the 2D Array but it was the fastest way that came to my mind.


Thank you in advance.read_ini_file.png


0 Kudos
Message 1 of 5
Accepted by topic author AldhairGarza

I find no issues with the way the VI is laid out in terms of wire bends.  It is clean and readable.


The two small comments I have:

1.  You do an Insert Into Array at position 0.  To me that should be a Build Array.  For elements added to the beginning or end, that screams to me it should be Build Array, which is probably 95% what I'm doing.  Only for elements inserted in the middle, or at some programmatically defined position which might be beginning, middle, or end, would I use Insert int Array.

2.  Steps 8, 9 and 10 use a total of 5 nodes.  To me it looks like you are doing a Reshape Array.  That would be 1 node and two constants.  Perhaps a Transpose Array in there depending on which way the 2-D array needs to be arranged.

Message 2 of 5

I made the changes you mentioned and they work like a charm.

I'm a new fan of Reshape Array.


Thank you very much!

0 Kudos
Message 3 of 5
Accepted by topic author AldhairGarza

This isn't bad. I can give you a few notes though to make things a little better. The good news is this is at the point of "working but needs some tweaks", not "what the heck was OP thinking" 😉 Please don't take this as being harsh, just a few things I noticed.


Style stuff:

- Wire bends: This is mostly fine but I'd recommend keeping the error bars and the "main wire" (in this case the ini file reference) unbent. Move the "Keys" array higher, along with the output tunnel.

- Front panel: Don't save subVI's with full screen front panels. Just make it as big as it needs to be.

-The Keys constant should probably go outside the For loop (for stylistic reasons) but should definitely show the items you're iterating through.


Functional stuff:

- Error wires: The errors in this subVI don't propagate or do anything. I would recommend adding Error In and Error Out clusters on the front panel. This way, the calling VI will know if the "read ini file" function worked or not. Right now, upstream code can only assume the ini file read worked.

- Inner For loop iterator: You wired a 2 to the inner For loop, which means it only read Price and Inventory for each item. I don't know if this was intentional or not.

- Product display field: You mentioned yourself this was non-ideal. In this case, instead of using a 2D array, I'd use a 1D array of clusters, where each element was an item. This will be infinitely scalable and MUCH easier to read and understand.

-Data types: Storing Price as a String is going to be a pain in the butt, trust me. You want to use a Numeric type here.

- You probably knew this but none of your controls or indicators are wired to the connector pane 🙂


See the attachment for the recommended changes being implemented. It sounds like a lot of stuff but I'm just being thorough- you'll see that functionally it's basically the same.


read ini v2.png

Message 4 of 5

Thank you ver much! The 2 in the For Loop was intentional, since I didn't need the four elements(I should have deleted them).


About the dimension of the Array, it was a "requirement" the CLD Test wanted that format and all the data was strings, I think the Price was even with "$" at the beginning(in the indicator).

Thank you very much again.

0 Kudos
Message 5 of 5