# Button click to move row down 3 rows

So I’m trying to make a flash card app for my son to practice his words. If he gets a word wrong, I want the card to basically go back three cards in the stack so he will be asked the card again. The way I’m doing this is on the flash card there are two buttons, “Correct” and “Try Again”. When that button is clicked it will document that he got it wrong in a table called “Progress Data” and then in a separate table is where it will move the row. The document I’m working on is below:

You’ll see a couple different columns to randomly sort and then rank the words. I’ve tried a few different ways but am at a loss. Does anyone on here have an idea to try? The one thing to think about is when the word gets towards the end of the “stack”, it won’t always be able to go back three places. Not sure how to account for that either. Thanks for any ideas!

I’m completely unsure of what I’m gonna say (as a news user, I sometimes have difficulties putting my mind into docs I didn’t create (but I’m working on that )) but have you try a `ModifyRows()` with `Last()-3` for the rank that needs to be changed ?

Maybe this could help too ?

(By the way, I like your idea of the virtual flash-cards system for teaching words to your son . This is pretty cool )

Here’s my solution. I made from scratch it in a separate doc (simpler for me, and cleaner for everyone to understand).

The idea is to start with a queue where all words are ranked with unique integers, then when a row needs to be moved to the 3rd position, assign the rank to that of the 3rd row. But since we now have multiple rows with the same rank, we now also need to additionally sort them on `Modified on`. In formula, you first have to sort on Modified on, then by Rank. Now, your head-of-the-queue word will always be placed right after the current 3rd row (then everything shifts, and your word becomes the third).

Demo:

1 Like

Thanks @Paul_Danyliuk. It sounds like it might work, but I’m just at a loss on how to possibly implement for my situation. I believe I already have a unique integer for each (All Words section, Ranked Order column). But I’m not sure how to translate the rest.

You have a DB of words. Just make a separate table for the queue of words to learn, then populate it each time you start a learning session or something. And don’t modify your DB of words.

And don’t calculate rank with a formula. Rather assign it into an editable field with a button.

Here is my attempt. I copied your doc and added the section “New attempt” at the top -

I set it up so that when you “Retry” a word, it moves to a random position between x and y. The References page lets you define the range. I set between 3 and 6 as the default. The formulas also take into account when the number of words remaining gets down toward zero.

Let me know if anything needs clarification.

Rohan

There are a couple of things that are bugging me though -

1. I seem to have to use .ToText for some of the comparisons (ie. the comparison doesn’t work without .ToText), and I don’t understand why this is
2. If I copy the actual “New Position” formula into the places where it is used, then it doesn’t work as intended, and again, I don’t understand why. But if I reference the button, it works exactly as intended. It’s very odd.

Rohan

Thanks! The copy of my doc is view only though so I can’t see the formulas you did? Can you send me a link to an editable version so I can see what you did?

Click the “Open in Coda” button -

Then click the “Copy Doc” button at the top right of the window -

Let me know if that doesn’t work

Silly me… The mark of a newbie still!