Red Lion Crimson 3 : Searching a text file

ChrisAllen

Member
Join Date
Jan 2013
Location
Bedfordshire
Posts
1
Hello All,
I am currently implimenting a system to log details of customers using a G310 as the interface, however I am new to Crimson and am stuck!

In basics what I need to do is search a text file for a number (customer No.) and return the line on which that number is found (the rest of the customer details), is there a way to do this in Crimson?

The text file contains all the customer details on a line, the first column being the customer number. The customer will input their number and hit an ok button afterwhich I need to search the file for a match to that number and then return the line so the rest of the customer details can be automatically filled in the relevant fields.

Can anyone help me??

Many Thanks, Chris
 
Normally when reading from text files (I assume you are referring to those stored on CompactFlash) I read the whole thing into the G3's memory first, using a single string array (one line of data per element) or a series of them (one array for each data item). Then you can use the string manipulation commands like Len(), Left(), Right(), and Mid() to locate or modify the data in a specific array element.

It works well if your customer number is fully numeric, because it can be represented by the array index and this eliminates the need for a search routine. For example, if you read a line of data and the customer number happens to be 79, store the whole line in StringArray[79]. Crimson 3 seems to support non-retentive arrays with up to 4000 elements but this is dependent on available memory. If you import the text file into separate arrays for each data item, the display fields on the screen can directly access those items, e.g. CooldownTime[CustomerNumber].

The situation is more difficult if you want to update the text in the file as the user enters it. (I wasn't clear from your post if you need to do this.) I'm not sure if this can be done except by clearing the file and writing the entire string array back to it every time a change is made.
 

Similar Topics

How do you install update on Red Lion Crimson ver 3.1. Do I just need to run the exe file on the host server?
Replies
1
Views
115
Hi, I am trying to increase the size of the user login pop up using a Red Lion CR1000 7” HMI with Crimson 3.1 software. The login pop up is very...
Replies
2
Views
687
Hello, We are currently running a bunch of g310's connected to their SLC5 PLCs through ethernet. I've attempted to upgrade the program from 2.0...
Replies
1
Views
1,126
Hi I have been using Red Lion products for some time, I had a thought over the bank holiday weekend, As you do. It would be nice if whenever a...
Replies
4
Views
1,024
Well, I have yet another question for the great minds on this forum! We have a red lion HMI for one of our machines and every time I hook my...
Replies
11
Views
1,678
Back
Top Bottom