06-28-2019 12:10 PM
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
Solved! Go to Solution.
06-28-2019 12:37 PM - edited 06-28-2019 12:38 PM
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.
06-28-2019 01:13 PM
Many thanks, that did the trick!