Hello! I am struggling to create an easy database template for importing data from a manual CSV export with some weirdness to it. Then an interface for data visualization that once was done using a platform that linked directly with the app generating the data.
The app generating the data exports two CSV files, one for a list of “interactions” and one for a list of “buttons”, so I started with a table for each with the same fields. Each interaction row contains a lot of data pertaining to the user, so I added a 3rd table of Users in Airtable, and just made those fields in the Interactions table lookup fields to pull from Users. The Interactions can have up to 12 Buttons, and the export has several columns for each button - some of it is unique to the interaction and some applies to every use of that button, so I have put that info in the Button table and the fields in Interactions are now a lookup. The Interactions records also include date and time of the start of the interaction, and duration of interaction
Sounds simple, right? Except I just realized the Interactions export isn’t behaving as I assumed it was. If an interaction included two buttons, the first button utilized is listed as Button 2. So Button 1 is always the LAST button in the interaction, and there could be 1-12 buttons in each interaction. It also turns out that each button is listed only once, even though the real-life situation recorded in the app could have included multiple uses of a single button. There is one field in the Interactions CSV that lists the buttons in the true order (only spaces separate the buttons, and some button names contain spaces so I can’t use spaces in a formula to separate each button), but this also lists only unique button presses rather than all presses of any button in a single interaction.
So now I am sad my formulas and counts are all wrong, and here I thought all I needed help with was the following statistics!
1. If an interaction includes button X, what is the button most likely to follow X?
2. What is the most common combination of 2 buttons? 3 buttons? Etc In a certain order or not
3. I wanted to capture the buttons that get pressed twice in a row, but now I’m at a loss. There is one field with the number of presses, and a separate field with the number of buttons pressed, and this at least tells me one or more buttons in the interaction got multiple presses
For the interface visualizations, I’m wondering if I can get (with filtering for user, which is thankfully simple for interactions but not currently appearing in the Buttons table):
1. Interactions: A line graph with right y-axis just showing average number of presses over time, and left y-axis centered over 0 and showing daily/weekly/monthly deviation in number of interactions (based on whatever x axis we go with).
This is relatively simple except the left y-axis, which I assume requires a formula field somewhere but what/where?
2. Buttons/user: List of just the top 5 buttons use within the past week, with filtering by User
Right now I have a list of all button presses sorted with the ones with the most interactions at the top, and I change the color of the text for buttons with interactions over a certain number, but I have to manually change that threshold right now. Boo.
3. Pivot table with the combos, like if button in row label appears in an interaction, how many of those interactions also contain the buttons across column header?
I put this question under Formulas because to move forward with any of this I need fields in the Interactions table reversing the order of the button presses, and whatever formulas/ roll ups etc. necessary for getting the visualizations I am hoping for. I include the rest of this novel for context I hope is helpful!!
Page 1 / 1
Hey @Melissa_Frank1 all these seems quite some things to do, but also something that can be done within a 5 minutes call. If you are interested I am more than happy to accommodate some time (free) and jump on a quick call. I am sure we can tackle most of this in no time.
Hey @Melissa_Frank1 all these seems quite some things to do, but also something that can be done within a 5 minutes call. If you are interested I am more than happy to accommodate some time (free) and jump on a quick call. I am sure we can tackle most of this in no time.
There’s also a Google Sheets version because there previously was a LookerStudio connection and someone else tried to convert it to allow imports of chunks of data.
Hey @Melissa_Frank1 all these seems quite some things to do, but also something that can be done within a 5 minutes call. If you are interested I am more than happy to accommodate some time (free) and jump on a quick call. I am sure we can tackle most of this in no time.
Thank you @felipe-saucedo for your time! I appreciate the suggestion you had to create an automation to add a record to a new table for joining the Buttons and Users. I will give that a try this afternoon. It makes sense that we would need a script to get the statistical analysis I was hoping for, to see what the most common button combos are.
Re the sample data, there is a column in the Interactions CSV called all_buttons. This field has all of the presses I want to use for analysis, but they are not separated by comma, semicolon… just a space. But some button names have more than one word. So is there a way to have Airtable translate the data in that field into the sequence of buttons that were pressed? I cannot imagine this would be possible without running some script somewhere, but counting buttons from this field is far more accurate than the alternatives.
Oof, if they’re not separated by comma and they can span more than 1 word it’ll be hard to come up with a script or regex solution… Do they have any kind of commonality to start or end with aside from a simple space like starting with “Button” or something ala Button Stop Button Go Button Submit and Reset Button Start because then you could use the word Button to indicate where to split things…
EDIT- Just realized you had posted sample data… hmm
Oof, if they’re not separated by comma and they can span more than 1 word it’ll be hard to come up with a script or regex solution… Do they have any kind of commonality to start or end with aside from a simple space like starting with “Button” or something ala Button Stop Button Go Button Submit and Reset Button Start because then you could use the word Button to indicate where to split things…
EDIT- Just realized you had posted sample data… hmm
Tragically, no. I thought I could do an automation to grab Button_12 then Button_11 etc in a single field linking to the Buttons table, but I can’t add more than one. Either, one button gets added, or it merges all the button names into a single new button.
So I had the idea to change the names of buttons with more than one word so the spaces would only separate buttons. But I would need other people to be able to use this with their buttons, too, so not the ideal solution.
Thanks for the data!
1. Interactions: A line graph with right y-axis just showing average number of presses over time, and left y-axis centered over 0 and showing daily/weekly/monthly deviation in number of interactions (based on whatever x axis we go with).
This is relatively simple except the left y-axis, which I assume requires a formula field somewhere but what/where?
Hmm...how did you end up doing this? I was thinking about it and the only way I could think of doing this was with a table where each record represented a single Button <> Interaction with the date
---
2. Buttons/user: List of just the top 5 buttons use within the past week, with filtering by User
Right now I have a list of all button presses sorted with the ones with the most interactions at the top, and I change the color of the text for buttons with interactions over a certain number, but I have to manually change that threshold right now. Boo.
Interesting! I take it you linked button_1, button_2 to the Buttons table and did Count fields there and summed everything up?
---
3. Pivot table with the combos, like if button in row label appears in an interaction, how many of those interactions also contain the buttons across column header?
Hmm, I can’t really imagine how this one would work, but it does feel like a script’s your best bet
You could also try going down a (probably crazy) road of creating a table that contains combinations, and then using formula fields and automations to populate it. e.g. if the buttons were ‘Catch, Please, Frisbee’, then you’d have three records in that table:
Catch, Please
Please, Frisbee
Catch, Please, Frisbee
And this would show you the combinations (ordered only, but if you wanted it unordered you could potentially do that too but at that point you should just write a script I reckon) and also the most likely button to follow
Theoretically possible, but yeah I’d say just use a script heh
Split the space‑separated button list into an array (e.g. SPLIT({Button Order}, " "))
Use ARRAYREVERSE() to flip order
Use indexing like ARRAYJOIN(ARRAY_SLICE(...), " → ") to map sequence transitions
For repeated presses, compare adjacent items in the reversed array for equality
Split the space‑separated button list into an array (e.g. SPLIT({Button Order}, " "))
Use ARRAYREVERSE() to flip order
Use indexing like ARRAYJOIN(ARRAY_SLICE(...), " → ") to map sequence transitions
For repeated presses, compare adjacent items in the reversed array for equality
Interesting! I will try this, thank you. Will the split work, though, with buttons that have spaces in the name? I thought I would need something that searches the list of buttons for matching names. I have done something like this with macros in Excel, but I’m struggling in Airtable.
Thanks for the data!
1. Interactions: A line graph with right y-axis just showing average number of presses over time, and left y-axis centered over 0 and showing daily/weekly/monthly deviation in number of interactions (based on whatever x axis we go with).
This is relatively simple except the left y-axis, which I assume requires a formula field somewhere but what/where?
Hmm...how did you end up doing this? I was thinking about it and the only way I could think of doing this was with a table where each record represented a single Button <> Interaction with the date
---
2. Buttons/user: List of just the top 5 buttons use within the past week, with filtering by User
Right now I have a list of all button presses sorted with the ones with the most interactions at the top, and I change the color of the text for buttons with interactions over a certain number, but I have to manually change that threshold right now. Boo.
Interesting! I take it you linked button_1, button_2 to the Buttons table and did Count fields there and summed everything up?
---
3. Pivot table with the combos, like if button in row label appears in an interaction, how many of those interactions also contain the buttons across column header?
Hmm, I can’t really imagine how this one would work, but it does feel like a script’s your best bet
You could also try going down a (probably crazy) road of creating a table that contains combinations, and then using formula fields and automations to populate it. e.g. if the buttons were ‘Catch, Please, Frisbee’, then you’d have three records in that table:
Catch, Please
Please, Frisbee
Catch, Please, Frisbee
And this would show you the combinations (ordered only, but if you wanted it unordered you could potentially do that too but at that point you should just write a script I reckon) and also the most likely button to follow
Theoretically possible, but yeah I’d say just use a script heh
For 1… still haven’t worked this out. I don’t have access to the old LookerStudio details to see how it was done before. I may have to leave this one to the app developers to provide something in the export.
Re 2, you are correct. It’s very annoying though that I have up to 12 button positions for each interaction, so needed 12 count fields for all interactions, 12 count fields fields for all of User A’s interactions only, etc. Maybe I can do this conditional as a filter in the Interfaces, I actually hadn’t thought to check. Will do today!
And for 3, this suggestion is very interesting! I need to work out a way to do this with Automations though, and in a way that won’t merge button names in a new button… I like where this is going, though.
I am going to experiment with changing the formula for the Interactions records name - just had a lightbulb tell me I should put the User in there so it comes up in the linked records in the Buttons table...
re: For 1… still haven’t worked this out. I don’t have access to the old LookerStudio details to see how it was done before. I may have to leave this one to the app developers to provide something in the export.
Hmm, yeah. Let me know if you want to go down this road manually, I think I have an idea for this. How does the data get populated btw? Is it a constant sync? Or like you’re going to do imports once in awhile?
---
re: Will the split work, though, with buttons that have spaces in the name?
Ah there’s no such thing as ‘SPLIT()’ or ‘ARRAYREVERSE()’ at this point, so I don’t know whether you should spend too much time trying out that solution I’m afraid
---
That Interface looks really neat!
@Melissa_Frank1 +1 this Interface looks very cool! Please share the finished product and how you got there in Show & Tell if you can for others to learn from
re: For 1… still haven’t worked this out. I don’t have access to the old LookerStudio details to see how it was done before. I may have to leave this one to the app developers to provide something in the export.
Hmm, yeah. Let me know if you want to go down this road manually, I think I have an idea for this. How does the data get populated btw? Is it a constant sync? Or like you’re going to do imports once in awhile?
---
re: Will the split work, though, with buttons that have spaces in the name?
Ah there’s no such thing as ‘SPLIT()’ or ‘ARRAYREVERSE()’ at this point, so I don’t know whether you should spend too much time trying out that solution I’m afraid
---
That Interface looks really neat!
Re 1: LookerStudio did have a constant sync, but it’s not in the list of connectors any longer. I don’t know why they stopped using it, but I believe they’re planning to build some of their old dashboard template into the app. Currently, though, things they’ve already moved into the app cannot be shared with a static link, and we human users like to compare notes and work together on common challenges sometimes. I’m not sure how people were putting this particular chart to use back when it was functioning… maybe tracking overall behavior changes.
Frustratingly, we will have to manually add exports over time, and we cannot set a filter before exporting, so I have been deleting records for the day of export and using that to delete duplicate lines in new exports. It’s a manual process all users will just have to look out for, but it’s simple enough to do. If anyone wants to update fields they didn’t previously fill, I’m not sure there’s any good reason to do that in the app, versus just doing it in Airtable going forward.
Glad you like the interface! I would love to be able to put a table of contents or something at the top but Airtable’s not quite there… yet. The developments made since I first started using it over a decade ago are truly incredible, so I don’t count much out. (The only “no” I’ve ever gotten was when I asked about HIPAA and FERPA compliance And we were able to manage FERPA in-house.)
Hi @Melissa_Frank1,
Great job on the interface, its looking fantastic.
I have a suggestion for your buttons dilemma. It will utilize a script and another table. The idea is that using all the actual possible button names from your buttons table, we can give a script an array of possible names, then pass the field of all_buttons and have it return an array of buttons in reverse order. This would make sure that any spaces wont matter since the script will know what constitute a button from the list of buttons. From here you can pass this array of names and create new records in a new table called “Button Press Log” or something like that. Your automation will create a new record here with each of the buttons that were outputted by the script.
For example, if you have an all_buttons field say “Wind Yes Noise Noise”, then your script will return an array of rNoise, Noise, Yes, Wind]. Then the automation will create 4 new records in this new table with these button names and it will also tag each of these names to the actual Button table so that you can get lookups and rollups in there to help with your statistics. This is a way to get around linking multiple repetitions of a button multiple times in a linked record field.
Here is a sample script you can use:
// Replace this with input.config() to get an array from the result of a find block from the Buttons table. let possibleButtonNames = i "Poops", "Ear", "Oopsie!", "Love you", ];
let reversedSequence = "Oopsie! Poops Poops Love you Love you Ear";
//Sort names by length so multi-word names match first let sortedNames = possibleButtonNames.slice().sort((a, b) => b.length - a.length);
//Parse function parseReversed(names, str) { let out = <]; let remaining = str.trim(); while (remaining.length > 0) { // find the first name that matches at the front let match = names.find(name => remaining.startsWith(name)); if (!match) { throw new Error( `Unable to match any button at: “${ remaining.slice(0, 20) }…”` ); } out.push(match); remaining = remaining.slice(match.length).trim(); } return out; }
//Output let parsedReversed; try { parsedReversed = parseReversed(sortedNames, reversedSequence);
//reverse order let originalOrder = parsedReversed.slice().reverse();
//Original order of buttons pressed console.log("Original order of buttons pressed"); console.log(originalOrder); //Replace this with an output.set('original_button_press_array', originalOrder);
The way to architect this is going to be unique to how you plan on calculating your statistics so some further considerations are probably needed. Happy to discuss this further if you think this is going in the right direction!
Found this!! I adapted the code to my tables and ran the script and I think this might be the answer to some of our needs… Going to play with the results a bit and see if we can live with this. I still want to play around with the idea of creating a record for each combo of buttons per interaction, and a table that joins the buttons and users. But that’s a project for tomorrow...
Hi @Melissa_Frank1,
Great job on the interface, its looking fantastic.
I have a suggestion for your buttons dilemma. It will utilize a script and another table. The idea is that using all the actual possible button names from your buttons table, we can give a script an array of possible names, then pass the field of all_buttons and have it return an array of buttons in reverse order. This would make sure that any spaces wont matter since the script will know what constitute a button from the list of buttons. From here you can pass this array of names and create new records in a new table called “Button Press Log” or something like that. Your automation will create a new record here with each of the buttons that were outputted by the script.
For example, if you have an all_buttons field say “Wind Yes Noise Noise”, then your script will return an array of rNoise, Noise, Yes, Wind]. Then the automation will create 4 new records in this new table with these button names and it will also tag each of these names to the actual Button table so that you can get lookups and rollups in there to help with your statistics. This is a way to get around linking multiple repetitions of a button multiple times in a linked record field.
Here is a sample script you can use:
// Replace this with input.config() to get an array from the result of a find block from the Buttons table. let possibleButtonNames = i "Poops", "Ear", "Oopsie!", "Love you", ];
let reversedSequence = "Oopsie! Poops Poops Love you Love you Ear";
//Sort names by length so multi-word names match first let sortedNames = possibleButtonNames.slice().sort((a, b) => b.length - a.length);
//Parse function parseReversed(names, str) { let out = <]; let remaining = str.trim(); while (remaining.length > 0) { // find the first name that matches at the front let match = names.find(name => remaining.startsWith(name)); if (!match) { throw new Error( `Unable to match any button at: “${ remaining.slice(0, 20) }…”` ); } out.push(match); remaining = remaining.slice(match.length).trim(); } return out; }
//Output let parsedReversed; try { parsedReversed = parseReversed(sortedNames, reversedSequence);
//reverse order let originalOrder = parsedReversed.slice().reverse();
//Original order of buttons pressed console.log("Original order of buttons pressed"); console.log(originalOrder); //Replace this with an output.set('original_button_press_array', originalOrder);
The way to architect this is going to be unique to how you plan on calculating your statistics so some further considerations are probably needed. Happy to discuss this further if you think this is going in the right direction!
Oh this sounds great! I will give this a shot after a good night’s rest Thanks!
re: Frustratingly, we will have to manually add exports over time, and we cannot set a filter before exporting, so I have been deleting records for the day of export and using that to delete duplicate lines in new exports.
Hmm, could I check if you’re familiar with the CSV Import extension? The ‘interaction_id’ field seems to be unique, so if you used the CSV Import extension, turned on ‘Merge with existing records’ and pointed it at that field you shouldn’t have duplicate lines I believe
Split the space‑separated button list into an array (e.g. SPLIT({Button Order}, " "))
Use ARRAYREVERSE() to flip order
Use indexing like ARRAYJOIN(ARRAY_SLICE(...), " → ") to map sequence transitions
For repeated presses, compare adjacent items in the reversed array for equality or visit happymoodhub for more guides by getting a AI solution app.
Interesting! I will try this, thank you. Will the split work, though, with buttons that have spaces in the name? I thought I would need something that searches the list of buttons for matching names. I have done something like this with macros in Excel, but I’m struggling in Airtable.
almost, it will works with it, you have to give it a try.