LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Core 1 v2015 Exercise 9-4B issue - noob needs help :)

Solved!
Go to solution

Hello All,

Working my way through the self paced online training (Labview noob!). Unfortunately I am having issues with challenge 9-4B. I've attached my code and sample output file that its reading from, for some reason I cant get the search array to work properly, it always spits out -1 as if it didn't find anything. I've created a few indicators to see what the arrays looks like at different stages but cant figure out why its doing this. Also here is the initial problem statement.

"Goal

Create a VI that takes the property name as input and returns the associated property value.
Scenario
Your file header includes a variable number of property names and values. After reading the file, you want to programmatically access the property value
for a given property. For example, in this exercise, one of the properties was “UUT Serial Number”. You want to programmatically search for “UUT Serial
Number” and then return the serial number value (e.g., “A12345”).
Description
After reading the spreadsheet string into memory, use a modular approach to create a VI which finds the row index of a property name. Then use the row
index to return the property value. If the property name isn't found, the VI should return a descriptive error."

Any help would be much appreciated Smiley Happy

0 Kudos
Message 1 of 3
(2,012 Views)
Solution
Accepted by topic author Grayman2019

Your string data has a lot of spaces in it.  So if you search for "Time", you won't find it because the element has "Time{space}" as the element.  If you click on an element in the "2-D Array of Strings" indicator and turn on \code display, you'll see it.

 

Clean up the program that created the file so it doesn't create the spaces.  There is also a functions called "Trim White Space" that could help if you iterate through each element of the 2-D array.

Message 2 of 3
(2,002 Views)

Many thanks, that did the trick!

0 Kudos
Message 3 of 3
(1,987 Views)