Crimson CSV Files

Brijm

Lifetime Supporting Member
Join Date
May 2006
Location
St. Marys, PA
Posts
645
I recently did a project, where I was parsing CSV files in Crimson3, and thought this program may be of use to some.

Setup a program data type string with two parameters (cstring sText, int nPos) Calling the function with Parameters(test,0) will return the first comma separated variable in string test. The delimiting character can be easily changed as well.

Paste the following in your code:
/* cstring CSVSeek(sText,nPos)
Finds Target Position in a CSV string Starting with 0
Returns sText if no "," exists at Pos
*/

int nFrom, nTo,nCount;
int delimiter = ',';

if (nPos == 0) nFrom = 0;
else nFrom = Find (sText,delimiter,nPos-1) + 1;

nTo = Find(sText,delimiter,nPos);
if (nTo == -1) nCount = Len(sText) - nFrom;
else nCount = nTo - nFrom;

if (nFrom == -1) return sText;
else return Mid (sText, nFrom, nCount);
 

Similar Topics

I have created an application for Redlion G3 HMI which is saved as a crimson .cd3. I basically want to view my data in Excel. I believe it is...
Replies
4
Views
3,662
Hey guys, hoping someone here could give me a little advice. I'm working with a CR1000-04000 in Crimson 3.1 and I was interested in adding the...
Replies
4
Views
124
Hi, I'm having an issue in crimson 3.0 when I create a programme using a case statement referencing a fault word that each bit needs to change the...
Replies
5
Views
217
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
107
Has anyone found a way to convert/replace/update the firmware on old Parker TS80xx series HMIs (i.e. TS8010, TS8006, etc) to accept Crimson...
Replies
0
Views
91
Back
Top Bottom