Apr 17, 2020 11:40 AM
Do you have a block idea that could transform your workflow but are not familiar with React?
Chime in with your ideas here! And if you’re a developer who is exploring the community forum for ideas, hopefully this thread can become a resource for inspiration and user feedback.
Apr 17, 2020 02:56 PM
Fantastic idea.
Personally, I’ve been trying to wrap my head around a script that would take a selected record and split the value of one of it’s cells with a duplicate. This would really help for personal budgeting. So:
£155.34 | Supermarket
Split Record…
Creates a duplicate that I can enter an amount in…
£55.00 | Home
£100.34 | Supermarket
And the remainder is the new value on the old record.
You would need a <select>
to choose which column you were splitting, and perhaps later would ask how many duplicates you wanted.
Apr 17, 2020 06:25 PM
Hi @Russell_Bishop1 – the custom record-splitting you’re describing is definitely something that could be implemented with a new custom block, but it’s also very well-suited for the scripting block!
You got me curious, so I took a first-pass at what a script like that could look like – hopefully this can be a good starting point for your personal budgeting base. Here’s a quick video demo of the script running, and here’s the script itself:
const table = await input.tableAsync('Pick a table to split items in');
const field = await input.fieldAsync('Which field holds the value to split?', table);
const record = await input.recordAsync('Which record would you like to split?', table);
const recordsCreated = [];
const startingAmount = record.getCellValue(field);
let amountLeft = parseInt(startingAmount);
while (true) {
output.clear();
output.markdown(`### You have $${amountLeft} remaining to split. Continue splitting?`);
const result = await input.buttonsAsync('', [{label: 'Split', variant: 'primary'}, 'All done']);
if (result === 'All done') {
break;
}
let amountToSplit;
while (true) {
const amountToSplitAsString = await input.textAsync('How much would you like to split out?');
amountToSplit = parseInt(amountToSplitAsString);
if (amountToSplit <= amountLeft) {
break;
}
output.text('⚠️ That exceeds the amount left, try a lower value');
}
const name = await input.textAsync('What would you like to name this record?');
const newRecordId = await table.createRecordAsync({
[table.fields[0].id]: name, // Should probably replace `table.fields[0].id` here with a specific field name / ID
[field.id]: amountToSplit
// Add any additional fields you may want to set here (potentially using more inputs to choose a category, etc)
});
recordsCreated.push({recordId: newRecordId, oldValue: '-', newValue: amountToSplit});
amountLeft -= amountToSplit;
await table.updateRecordAsync(record, {
[field.id]: amountLeft
})
}
output.clear();
output.markdown(`### Created ${recordsCreated.length} new records`);
const resultTable = [
{recordId: record.id, oldValue: startingAmount, newValue: amountLeft},
...recordsCreated
]
output.table(resultTable);
Apr 18, 2020 04:48 AM
hello @Michelle_Valentine,
I recently talked about it with @Kasra: I was writting:
"…/… make the scripting block better for me would be :
I really would try to enhance Page designer by SCRIPTing."
In addition to this self-quote, I would add Extended Export Options to this wishful Block project:
Best,
olπ
Apr 18, 2020 09:56 AM
Wow! Maybe you should work for Airtable… :winking_face:
That’s incredibly helpful @Billy_Littlefield, especially with the video explanation.
I made a few small edits to fit my scenario. The first was to swap parseInt
to parseFloat
(thanks Stackoverflow) because the first test run was dropping my decimal places. Gotta’ count the change…
The other is to remove the ‘What to name it?’ as my primary field is actually computed.
My final steps to explore now…
Thanks for this foundation Billy – really helped me make progress!
Apr 20, 2020 02:05 AM
Thanks for the initiative, Michelle! I would like to get into react more, but I simply can’t find the time for it. Here is something I’ve been thinking about:
I store interview transcripts in Airtable, where individual statements are stored as individual records, called “Observations”. However, the overview of the transcript easily gets los. They are only linked to a particular session as a record in another table.
What I would like to create is a block that allows me to select the session I am interested in, and displays the linked observations in a certain format, including the speaker and time stamp, which are fields in the observations table.
A more general version of this might be a block that displays linked records in a more customisable way. So for example, I could imagine a block that helps me in this situation by displaying a summary of a linked record field that I select, which has multiple records linked. I would select the linked observations in my sessions table, for example, and have the linked observations displayed in a certain format. This could also be customizable so that other records that have links to multiple observations, e.g. tags that I am using to code my interview, can have their own custom summary of those observations.
I’ve used page designer before to re-create my transcripts, but it’s a very roundabout way to look for records in the page designer block when I’m going through them in my sessions table.
Apr 21, 2020 12:33 AM
Another one where I was wondering if it’s possible: A block that previews audio and video attachments in the base. Similar to the URL preview block, but for attachments. Is this possible?
May 21, 2020 07:59 AM
Can you actually attach audios and videos in the base? If yes, and if that’s something we can access using the APIs, we could make it. :slightly_smiling_face:
May 25, 2020 08:59 AM
There’s an attachment field type, which I’ve used with both audio and video files. you can’t preview them inside of Airtable, but you can download them.
May 25, 2020 09:16 AM
I was saying that we can build a block such that if you send the path to the video file in airtable, we can play it back in a video player. For example see this sample code:
May 26, 2020 12:49 AM
By path you mean the URL? According to this thread the URL for attachements can be got through FieldName[0].url
.
May 26, 2020 10:28 AM
We’ll investigate when we get there. But we’ll try to bring our blocks to Airtable and as I read through the documentation it seems to be an easy process.
May 27, 2020 03:28 AM
Cool! Sounds like you are already working on something like this?
May 27, 2020 10:10 AM
Hundreds of things like this. :winking_face:
May 28, 2020 11:00 PM
Cool, I’m eager to try it out!
Jun 16, 2020 04:46 AM
Hi @Michelle_Valentine
Waiting for answers to my last short chat here with one Airtable’s Dev Engineer,
but I was not in a hurry,
I’m going back to my previous inspiration:
I would get the possibility to FORK “PageDesigner airtable block”, seriously,
to learn & try to make it much better !
No, it’s really not a joke !
It’s a middle term wish because I’m completely out-of-time for the present Block creation contest as I got a lot of work at my main job that isn’t development but summer holidays are coming at the end of this month so I will get a lot more free time.
Best,
oLπ
Jun 20, 2020 07:50 PM
[quote=“Bill.French, post:8, topic:23130”]
Ergo, Page Designer is a nice friendly cul-de-sac.
in Automatic document creation and sharing from Airtable records
My motivation comes from my own Use-Cases but also from argued, discussed testimonials, like this one!
If you don’t have Time / (Wo)Men to continue developing and improving Page-Designer-Block, please don’t hesitate to open its FORK to Community Developers!
oLπ
Jun 20, 2020 08:39 PM
One of the best ideas I’ve read in many weeks!
Jun 22, 2020 11:46 PM
Hi Olpy,
Thanks for flagging that this would be useful for you! This is on our radar and requests like these are helpful in informing our prioritisation.
We’re going to continue releasing new open source blocks, but there are some hurdles for open sourcing existing blocks like page designer.
Thanks,
Emma
Jun 23, 2020 04:36 AM
Hi @Emma_Yeap
OK I can read and understand this.
However, I really need (and so do other Community Members and Experts as @Bill.French told us) another kind of Page-Designer-Block.
On my situation against advanced js and REACT, it would be quite more easy to start from some Page-Designer basic structure from Airtable than coding everything ex nihilo.
As I need a Page-Designer solution for 31/08/2020, I’m considering some Built-on-top-of-public-API ways of scripting too but at this time, I would prefer a Custom-Block to do the job.
Which job ?
As Page-Designer-Block is now “a nice friendly cul-de-sac”, I would prioritize Exports and Embed tasks and Automation too,
closely linked and controllable with airtable Tables, Views, Fields, Record’s data.
Best,
olπ