[i7] Simplest way of copying rows between tables

I want to move rows from one table to another in Inform7. Ideally this syntax would work (providing Blah was full of blank rows and the columns matched):

now row N in the Table of Blah is row N in the Table of Argh;

Evidently that doesn’t work. Imagine the setup is like this:

Table of Argh
Name Attribute Aspect
“A” 1 4
“B” 5 2
“C” 2 3

Table of Blah
Name Attribute Aspect
Two blank rows

After randomising Argh, I’ll want to repeat through (in this example) two rows and fill Blah with details of the selected rows:

repeat with N running from 1 to 40:
choose row N in the Table of Argh;

Now what?

1 Like

The simplest way isn’t particularly simple, but it’s straightforward: copy each entry using local variables.

To copy stuff:
	repeat with N running from 1 to 2:
		choose row N in the Table of Argh;
		let name-val be the name entry;
		let att-val be the attribute entry;
		let asp-val be the aspect entry;
		choose row N in the Table of Blah;
		now the name entry is name-val;
		now the attribute entry is att-val;
		now the aspect entry is asp-val;
3 Likes

Thanks. I was hoping there’d be an elegant way of doing it in bulk, but this works fine enough.