- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Delimit text and create new row
hey folks,
I am using a previous example from the forum.
My code works for the first part I am doing.
When I add the value into the new row I want to increment machine by 1.
So below would like ABC_RC1,RC2,RC3... not sure how to do this part.
machine | operation | recipename | Data_Column |
ABC_RC | 123456 | TEST | [0.941279597;0.941279597;0.947636808] |
Names Default To Here( 1 );
dt = Data Table( "Untitled 166");
dtOut = New Table( "Final Output1",
New Column( "machine", character ),
New Column( "operation", numeric ),
New Column( "recipename", character ),
New Column( "Data_Column", character ),
New Column( "Data_1", numeric ),
);
For( i = 1, i <= N Rows( dt ), i++,
If( i == 1,
theRow = 0;
theRow = N Rows( dtOut );
);
If( dt:Data_Column[i] != "X",
dtOut << Add Rows( 3 );
For( k = 1, k <= 3, k++,
theRow++;
dtOut:machine[theRow] = dt:machine[i];
dtOut:operation[theRow] = dt:operation[i];
dtOut:recipename[theRow] = dt:recipename[i];
dtOut:Data_Column[theRow] = dt:Data_Column[i];
dtOut:Data_1[theRow] = Substr( Word( k, dt:Data_Column[i], ";" ), 2, 7 );
);
);
);
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Delimit text and create new row
Could I add a new column and do a 1++ and the then concatenate?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Delimit text and create new row
Sorry, the concat wont work as it foes 1,2,3,4,5.... i need, 1,2,3,1,2,3.
Can I do this?
dtOut:RC[theRow] = Sequence( 1, 2, 1, 1 );
or just create a new column and do a sequence?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Delimit text and create new row
I have a feeling I'm not understanding what you're needing, but:
if the number you're adding to machine is the sequence of 1, 2, 3 repeated, would the modulo() function work for your needs? Something like the following?
"ABC_RC" || Char( Modulo( Row(), 3 ) + 1 )