cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
robust1972
Level IV

remove few items from a list using script

hi, everyone

I have a list like below and I wrote this script trying to remove items from a list using script which start with ".", but it reports error :"subscript range in access or evaluation of 'subscript', CSV_File_list[i]

=N Items(CSV_File_list);

(NOF);

(CSV_File_list);

(i=1,i<=NOF,i++,

(Starts With(CSV_File_list[i], "."),

Remove From(CSV_File_list, i),

);

CSV_File_list = {"FAB8_gf_MPW14011MA.A0_8XYL45155.049_A6-SRTOTPROM-14LPE.01_OTPROMMPW1401-SORT_04_BBOCN023SAG0_20150319-155848.csv", ".FAB8_gf_MPW14011MA.A0_8XYL45155.049_A6-SRTOTPROM-14LPE.01_OTPROMMPW1401-SORT_20150319-155445_04_BBOCN023SAG0_20150319-155848_20150319-171700.csv", "FAB8_gf_MPW14011MA.A0_8XYL45155.049_A6-SRTOTPROM-14LPE.01_OTPROMMPW1401-SORT_11_BBOCN016SAG7_20150319-171703.csv", ".FAB8_gf_MPW14011MA.A0_8XYL45155.049_A6-SRTOTPROM-14LPE.01_OTPROMMPW1401-SORT_20150319-155445_11_BBOCN016SAG7_20150319-171703_20150319-183919.csv"};


1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: remove few items from a list using script

As items are removed from the the list they get fewer than "NOF" and eventually i will exceed the current number of list items.

To avoid this, remove from the end:

For(i = NOF, i > 0, i--, ...)

View solution in original post

1 REPLY 1
ms
Super User (Alumni) ms
Super User (Alumni)

Re: remove few items from a list using script

As items are removed from the the list they get fewer than "NOF" and eventually i will exceed the current number of list items.

To avoid this, remove from the end:

For(i = NOF, i > 0, i--, ...)