02-23-2021 09:54 AM
In the attatched files, i want to run some test suites and use 'Group Array' and 'Test Array' as inputs from various tests. The other fields are always the same and have hardcoded them. Right now, i wired the hardcoded arrays as both name and value as i cant seem to find the proper block to input into the for loops. The output XML looks exactly as i want it, the only problem is the values i cant get working. Programatically, i would make an array of key-value pairs and iterate through that.
Thanks!
02-23-2021 10:41 AM
I'm not exactly sure I've understood what you want, but would the following kind of thing work?
Caller/Test VI (populate map and pass in)
Pass the Map into a For loop and autoindex
Here you can write a test (like the caller) that calls Insert into Map appropriately for each of the Keys you're interested in, and then get the values from the VI you're testing?
Then your subVI here can iterate through the Map and insert the XML attributes.
02-23-2021 12:08 PM
(On a side note, all three of your recent topics deal with basically the same thing. It would help to keep it all in one place)
02-24-2021 10:07 AM
Understood, will keep further discussions on this post.
How can i build a map from two 1D arrays? If i input the 2 arrays into a for with indexing enabled and use the build map function, it only lets me output with 'Last Value' enabled. I need to build these kind of maps with values from other blocks where the 'ITEMS' array is (almost) always the same but the 'VALUES' array varies accordingly with the tests i run.
Basically i need to input 2 arrays and output a map such that i can pull values by key in a different block.
02-24-2021 10:44 AM
Replace your tunnel with a Shift Register and wire an empty map onto the input side (it can be easier to create a constant after wiring the inside edges of the loop).
You want to call insert into map inside the loop in the situation you're describing, the output is a single Map, not an array so no need for indexing tunnels on the output.
02-24-2021 10:50 AM
Here's an example that I think shows what you're describing:
Then wire the map wherever you need it.
Of course, if you have two arrays like this, you could also use an array of clusters of Name/Value strings or a 2D array, if you don't need to search the data for a specific key in different orders than you insert them or similar...
02-24-2021 11:01 AM - edited 02-25-2021 01:13 AM
@AndreiV wrote:
How can i build a map from two 1D arrays? If i input the 2 arrays into a for with indexing enabled and use the build map function, it only lets me output with 'Last Value' enabled. I need to build these kind of maps with values from other blocks where the 'ITEMS' array is (almost) always the same but the 'VALUES' array varies accordingly with the tests i run.
Basically i need to input 2 arrays and output a map such that i can pull values by key in a different block.
Don't just randomly place primitives on the diagram! Most function have a help page as well as examples. Just place one of the map function on the diagram and do a "right-click...help" or "right-click...examples" and it will tell you exactly how to use it!
Critical beginner topics you need to learn are the various flavors of loop tunnels (plain, indexing, conditional, etc.) and the shift register. They occur in almost all programs.
In this particular case, here's the simplest way:
(If you want to learn more about sets and maps, have a look at my presentation from a few years ago. Enjoy!)
03-01-2021 04:24 AM
Thanks everyone for the answers!
Is there a way to enlarge the pin Window? I have found a way to make a pop-up window that tells you which pins are connected, but what about the case when i want to add a new pin? Its very small and it takes multiple tries to select the pin when there's a lot of them.
Have attached a photo of said window.
03-01-2021 04:36 AM - edited 03-01-2021 04:41 AM
Hi Andrei,
@AndreiV wrote:Is there a way to enlarge the pin Window? I have found a way to make a pop-up window that tells you which pins are connected, but what about the case when i want to add a new pin? Its very small and it takes multiple tries to select the pin when there's a lot of them.
When you use a connector pane (abbreviated as conpane, remember to use official LabVIEW terms) with so many terminals and you still ask for more terminals then you do something completely wrong! The common recommendation is to use the 4-2-2-4 pattern…
To answer your question: No, there is no way to enlarge the connector pane.
Would you write functions in text-based programming with 20+ inputs/outputs? Would you consider that as "good practice"?
03-01-2021 05:04 AM
I understand it's bad practice as but the schematic isn't mine. In case i have improperly worded my question: i dont want to add any extra pins, i just want to see if i can make the connection panel larger in size to be easier to click.
I cannot change the current number of inputs/outputs as they're part of a way larger project.