forcase loop

Discussions about editing and cleaning data
Post Reply
Posts: 312
Joined: July 22nd, 2016, 3:55 pm

forcase loop

Post by AriSilva » August 15th, 2019, 10:54 am

When reading an external file with the forcase, the inputorder is sequential or indexed?
If it is indexed, is there a way to force it to read it sequentially?
Or the other way around, that is, if it is sequential, can we force it to be read indexed?

Gregory Martin
Posts: 1270
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: forcase loop

Post by Gregory Martin » August 15th, 2019, 11:52 am

The current implementation only allows you to loop through cases in indexed order. You can change things to go in descending order: ... ement.html

If you really needed access to the sequential order, you can use the sqlquery function, but I wouldn't suggest creating an application where this was necessary. This, however, would get you what you want:
list string sequential_keys;
sqlquery(SECOND_DICT, sequential_keys, "SELECT `key` FROM `cases` ORDER BY `file_order`;");

do numeric counter = 1 while counter <= length(sequential_keys)
locate(SECOND_DICT, =, sequential_keys(counter));
    // do something

Post Reply