LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arrays or Spreadsheets? Help with School Excercise

Hello there, my Control Systems Engineering professor will make us a LabView test in a couple of weeks, although he won't actually teach us the software, but rather we need to get our hands dirty. Anyways, I'm trying to resolve this excercise:

Problem Definition.
On a storage area of a container terminal containers are stored temporarily waiting for further transportation. The location of a specific container along with its code is stored in a database. Whenever the operator types in the code of a container, the according location is shown on the screen.

Demands.
- Take as storing area a rectangle of 3 rows of 4 positions horizontal and 2 positions vertical (24 containers).
- Each containers is identified by a unique alphanumerical code of 11 digits. Digit # 11 is the check digit, being the last digit of the sum of the previous 10 digits based upon the ASCII table.
- When filling the database, the user myst apply the code of the container and its location.
- When searching for a container, the operator applies only the code of the container. On the front panel the according location must be displayed by the program.
- If a container is not found it must be reported by means of an error message.
- If an incorrect container code is inserted it must be reported by means of an error message.


What I've done so far:
I've made a UI and code so that I can type a 11 digit string and the VI will indicate me if its a valid code or not, based in the comparison of the 11th digit.

What I need:
Next step, I believe, is that if the code is valid, I should store it in a database along its position. I know that there is a Database toolkit for LabView, but you must agree it is impractical as this is just an excercise. I was thinking about making an array or a spreadsheet, but have no experience with it. Also it seems that arrays work best with For and While Loops, but I might be wrong... and how can the user assign its position?


Well, thanks all in advance for ANY suggestions. Everything is welcome.

Pohl.
0 Kudos
Message 1 of 4
(2,747 Views)
You have the right idea.

Use arrays to hold your data in the program, then use the Array to Spreadsheet String and some file functions, or perhaps the Write to Spreadsheet file. Or, you could do it the long way and programatically write all of your data into a very long string, and then write that string to a file. In general, I always try to write my data to a text file and let the spreadsheet program or external database handle the details for reporting. As you will learn, more often than not there are many different ways to accomplish the same task.

Good luck!

B-)
0 Kudos
Message 2 of 4
(2,721 Views)
Thanks for the advise! According to my workflow, this is what I should do:

1. Valid code?
IF TRUE: Scan string from file
IF FALSE: Display error
2. After scan, code exists?
IF TRUE: Show its position
IF FALSE: Ask if it should be stored

However, I'm having problems with a "too few format specifiers" error message with the Scan from File function. I'm feeding the 11 Character Digit to the "%" terminal... and don't know exactly which format specifiers to use.

:S
0 Kudos
Message 3 of 4
(2,708 Views)
 

Hello,

Take a look at the following link:

https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/errors/too-few-format-specifiers.html

it explains this error and also gives a link to the format you should use for this function.

Regards,

RikP - National Instruments Applications Engineering

Rik Prins, CLA, CLED
Software Development Engineer
0 Kudos
Message 4 of 4
(2,672 Views)