Button to Modify Rows, Split First and Last Name

Hi there! Totally new to Coda… apologies if this has been asked before (I looked and could not find anything :frowning:)

I have a table of contacts. My client wants to be able to load in a CSV. The CSV has the First and Last name in one field, and my contacts table does not.

I built a table view “Import New Students” to allow for him to copy and paste the CSV, and added two formula fields that split the first and last name up: [First Name (Import)] and [Last Name (Import)]. I want to finish it off with a button that takes the value of [First Name (Import)] for each row of “Import New Students” and inserts it into [First Name] (and same for the Last Name fields).

No matter what I do, I can’t get this to work. I end up with a list of everyone’s first name in the [First Name] field. How can I limit this to only the value of each row at a time?

Dear @Alli_Alosa,

Welcome to the community :handshake:

Rather sure that this post will be of your interest:

Hi @Jean_Pierre_Traets, thanks for the help. I did see that post… my problem isn’t splitting the name up - I’ve got that part done. I want to now use a button modify each row to insert the split name for each row into their respective [First Name] and [Last Name] fields.

Say I have two rows in my Import New Students table, John Doe and Jack Doe.

When I click the button I set up (with the Modify Rows action), I get “John, Jack” in my [First Name] field for both John Doe and Jack Doe. I want the result to be “John” in John Doe’s row and “Jack” in Jack Doe’s row.

I think the problem there is that, in your formula, you are referencing the whole Column. Try adding thisRow at the beginning of the formula and check if that works:

Help with thisRow Formula 2


Thank you for the input - this definitely has something to do with my problem… but the button is outside of the table, so I’m thinking that’s why thisRow doesn’t work. The below screenshot shows what I’m talking about… I want to move the highlighted fields with values [First Name (Import)] and [Last Name (Import)] into [First Name] and [Last Name], for all rows in this particular table.

I tried this with the Modify Rows action, and tried to use thisRow in the set-up, i.e. First Name = thisRow.[First Name (Import)], but it told me that was an “unexpected dot operator”. I will try to post a screenshot in another reply as I can only post image one in this post.

I also tried with a formula…

Sequence(1, [Import Students Test].Count(), 1).FormulaMap(ModifyRows([Import Students Test], [First Name], Nth([First Name (Import)], CurrentValue), [Last Name], Nth([Last Name (Import)], CurrentValue)))

The above says it updated 2 rows, but didn’t actually change anything.

Modify Rows Action Button Screenshot:

Oh right! I get it. So here’s my take on this:

You could also add a new column as a button and then the Finish Import Button can just press all the buttons in the table. Like this:

@Saul_Garcia THANK YOU! This is perfect - exactly what I needed! :slight_smile: You’re the best!

1 Like

I’m glad it worked! and happy to help! :smile:

1 Like