- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Issue with word and substring
I am working on a data table with more than 4000 rows.To get the data in required format I'm using word and substr functions within for each row loop. The functions work as expected for first 160 rows and no action is taken on rows beyond this point.Is this a network issue ? I tried adding Wait but doesnt help.
For Each Row(dt:col1 = Word(1,dt:col1, "S"));
For Each Row(dt:col2 = Substr( Char(dt:col2 ), 3, 2 ));
Thanks
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Issue with word and substring
A couple items, you are looping thru 4000 rows twice. You might want to loop once. You can use For Each Row( stmt1; stmt2 ) or a for loop. Also your code has dt:col2 = Substr( Char(dt:col2), 3, 2). Why do you have the Char() function? Does col2 have Character data type?
Below is an example using a For Loop, assuming col2 is defined as Character data type. You should look at the values in row 161
For(i=1, i<=nrow(dt), i++,
dt:col1[i] = word(1, dt:col[1], "S");
dt:col2[i] = Substr( dt:col2[i], 3,2 );
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Issue with word and substring
A couple items, you are looping thru 4000 rows twice. You might want to loop once. You can use For Each Row( stmt1; stmt2 ) or a for loop. Also your code has dt:col2 = Substr( Char(dt:col2), 3, 2). Why do you have the Char() function? Does col2 have Character data type?
Below is an example using a For Loop, assuming col2 is defined as Character data type. You should look at the values in row 161
For(i=1, i<=nrow(dt), i++,
dt:col1[i] = word(1, dt:col[1], "S");
dt:col2[i] = Substr( dt:col2[i], 3,2 );
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Issue with word and substring
I got rid of for each row and used for loop to make it work.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Issue with word and substring
Can you show us a couple of rows before row 160 and a couple after row 160?