Get FORMULA itself from CUSTOM-BLOCK + Example:

Hi @Kasra , @somehats , @VictoriaPlummer , Independant Developpers,

referring to:



I am showing this Custom-Block-Code detail:

        case FieldType.FORMULA: {
            // formulas are dependent on multiple fields in the same table. we want to
            // mark the link dependency in both directions, so add it to both the formula
            // field and the dependent field for each. we consider the target to be the
            // formula field itself, because other fields feed into its value.
            const {referencedFieldIds} = field.options;
            referencedFieldIds.forEach(dependentFieldId => {
                const link = {
                    id: createLinkId(field.id, dependentFieldId),
                    sourceId: field.id,
                    sourceTableId: table.id,
                    targetId: dependentFieldId,
                    targetTableId: table.id,
                    type: field.type,
                    tooltipLabel: LINK_LABELS_BY_TYPE[field.type],
                };
                linksById[link.id] = link;
                pushToOrInitializeArray(dependentLinksByNodeId, field.id, link);
                pushToOrInitializeArray(dependentLinksByNodeId, dependentFieldId, link);
            });
            break;
        }

to ask how to get the FORMULA itself
(for example: (LEN({IN-RICH_TEXT-contains-PlaceHolders})-LEN(SUBSTITUTE({IN-RICH_TEXT-contains-PlaceHolders},"-PH|","")))/4 )
programmatically from (any) FORMULA FIELD.

It was early possible by iterating _baseData / tablesByID / fieldsByID / typeOptions / formulaTextParsed: using previous and now deprecated Beta-Script-Block-API before 25/02/2020
but now, it’s not yet possible anyway by Script-Block.

Considering the time anyone can spent on efficient Formulas on Use-Cases where formulas nicely apply, my opinion is that my formulas belongs to me and to who I’m sharing them so it’s not breaking any airtable’s hidden feature to get my own written Formulas programmatically.

Thanks for your understanding,

oLπ

Hi @Olpy_Acaflo!

Formula text is not currently included in the public type options for any formulaic field type for either the custom blocks or scripting API. I’ve noted your request for this feature, though!

If you don’t mind my asking, how would you like to use this formula text information within your script / custom block if it were exposed?

Thanks for the feedback!

Billy L

Hi @Billy_Littlefield airtable’s Dev !

Many thanks to have answered my message !

My expectations were:

  • programmatically push a raw backup of my main bases to my Local or Cloud usual Storage in csv or JSON : this is what I use to do with any data or digital content assets.
    That doesn’t mean that I do not give the highest confidence in airtable data storage but World in 2020 is as it is : your best Friend is not eternal or can be bought by a less friendly Dev Team than yours…

  • Programmatically collecting my own FORMULAS out of my own Bases to push them into my Snippets and Gems existing Base.
    Why ? further enhanced by a few metadata or keywords, as I just started to do with Code Snippets (mine and gifts) , I hope some reusability !

As my Activity Logs could tell , I’m really not a Base Scrapper: I just want to automate my own data management and reusability.

My first SignUp to airtable came after some hard search about what airtable propose : to store , manage , edit and share my professional knowledge and knowhow in motion picture color management and grading.

I don’t like all my first bases anymore now: I also want to programmatically Search & Replace a lot of read-only props: table name, fields name & description ! Impossible at the present moment !
This is worrying me while scripting more and more but only as a part-time scripter: a side-project near my Colorist job !

Thank you for your time about reading my point of view,

oLpY

Hi @Billy_Littlefield,
As is almost always the case when I address the Community, the AirTable Dev’s, I am in no hurry.
As the Community’s Learner-Scripters receive a lot of generosity from the Experts here, I always ask my questions or expose my problems, leaving time for reflexion to give me a suggestion or a solution.
I realize that since Script-Block and Custom Block have been around, I can’t stop waiting to use them to modify the read-only props of my tables or to improve the management of my Views, which seems to be requests that are quite out of the scope of the topics usually detailed here!
But reading one day the point of view of your Team interests me!
Best,
oLπ

Hey @Olpy_Acaflo,

Thanks for your continued enthusiasm for the custom blocks & scripting platforms! Both platforms in their current state provide means to read all data in your base, and most schema information – cell values, field configurations, tables, and views. As you’ve highlighted, there are a currently a few limitations: certain field properties like formula text, view filters & groupings. Similarly, you can write any data to your base, and as of v0.0.46 of the blocks SDK, you can perform metadata writes to create tables, create most field types, and update most field types.

As the platforms continue to evolve, we’ll continue to add more capabilities with the goal of unlocking new workflows like what you’re describing. Hearing feedback from developers like yourself is super helpful in determining what the biggest pain points currently are! With regards to your specific expectations:

  • While you can download CSVs of your tables through the main Airtable UI, programmatic CSV export isn’t something supported by the custom blocks SDK. That said, you should be able to access the necessary cell data through the existing APIs for scripting, custom blocks, or public API
  • As I mentioned in the initial response, formula text isn’t currently exposed in the field options for formulaic fields. I’ve marked your +1 for this feature request, though. Thanks for sharing your current workflow of saving formulas and code snippets in your own “Snippets & Gems” personal base – improving script reusability in particular is something on our radar for the future.

Cheers,
Billy

1 Like

Thank you very much @Billy_Littlefield for your answer and to have routed my searches to THIS

I am watchful and interested in any evolution you can offer to the Fields, Fields-Type, Fields-Type-Options, Formulas-Text, Views, Hidden-Fields, Groups manipulation aspects we talked about and I explained why: it really started when I entered Script-Block-Beta in 12/2019.

Best,
olπ