05-23-2017 08:30 AM
I am reading a CSV file and the input has a serial number. When inputting the number, I have it output certain variables which is in my code. I am trying to figure out how to do such a task where the program will check if there are more than one matching serial numbers and then pick the one that is the newest (the date and log time are closest to real time). Can someone help me
Solved! Go to Solution.
05-23-2017 08:43 AM - edited 05-23-2017 08:43 AM
Try reversing the array before the search. Then you just subtract the array length-1 (ie the final index) and the found index.
05-23-2017 09:28 AM
I implemented this but it did not change my solution. When I inputted the serial number, I still received the same value as before.
05-23-2017 09:34 AM
Show us your updated code so we can verify the issue. It worked for me.
05-23-2017 09:37 AM
Here is my code
05-23-2017 09:43 AM
Remove the Start Index on the Search 1D Array. You are essentially skipping the last row.
05-23-2017 10:29 AM
Why are you using the array size, the -1 to the index and then the subtraction of both of them?
05-23-2017 10:45 AM
Size-1 is the index of the final element. If we have 3 items in the array, the size will return 3, but the final index is actually 2 (0, 1, 2). Therefore we have to subtract 1. We will just call that final index N. So when we reverse the array, what was at N is now at 0. So N-0 = N (index of item in the non-reversed array).