Help

Get first Letter of words to create acronym

Topic Labels: Scripting extentions
2038 8
cancel
Showing results for 
Search instead for 
Did you mean: 

Hello,

I consult and deal with a lot of companies who only use their acronyms…

I am creating a light CRM, and would like to Input the org name into a field, and have a script that returns the acronym for the name in another field.

I have found it very hard to do in Airtable without a Zapier integration, I wonder if the scripting block can help solve these problems.

Any help and code would be greatly appreciated!! Thank you.

8 Replies 8

This should do the trick:
This splits a phrase at spaces, returns another array of the capitalised first letters and then joins them back together with no separator.

    "Today I Learned".split(" ").map(word => word[0].toUpperCase()).join('');

This is just freakin’ clever - thanks!

thank you for the help!

I am able to create an acronym from a string, however, how can I get this to split the record I am referencing for all the records?

let OrgTable = base.getTable(“Organizations”);

let orgName = OrgTable.getField(“Organization”);

let queryResult = await OrgTable.selectRecordsAsync();

let record = queryResult.records[0];
?record.split(" ").map(word => word[0].toUpperCase()).join(’’);

I appreciate the support

You’ll want to call split on the org name, not the record itself — try replacing that line with this:

let orgNameForRecord = record.getCellValueAsString(orgName);
let acronymForRecord = orgNameForRecord.split(' ').map(word => word[0].toUpperCase()).join(’’);