Is there a way to return the row number of a table you’ve just chosen? For example, I want to do something like this:
choose the row with a fruit of "banana" in the Table of Tasty Fruit;
let R be the number of the row we just chose.
Is there a way to return the row number of a table you’ve just chosen? For example, I want to do something like this:
choose the row with a fruit of "banana" in the Table of Tasty Fruit;
let R be the number of the row we just chose.
Maybe try “Let X be the table row with…”
“Do something with X…”
You could try this, which I think is not appreciably slower than the “choose a row” formulation:
let R be a number;
repeat with N running from 1 to the number of rows in the Table of Tasty Fruit:
choose row N in the Table of Tasty Fruit;
if the fruit entry is "banana":
now R is N;
break;
if R is 0:
say "Uh-oh! Banana not found! Here's where you'd usually get a run-time error."
(As far as I know there isn’t any way to get the row number directly in I7. zarf can tell you if there’s an I6 way.)
There’s a very grotty I6 way:
To decide what number is the current row: (- {-my:ct_1} -).