Sep 13, 2022 11:02 AM
Hello-
I have this formula:
IF({DESIGN: UNDER REVIEW},SUBSTITUTE(
RIGHT(‘’&{DESIGN: UNDER REVIEW},1+
LEN(‘’&{DESIGN: UNDER REVIEW})-FIND(‘https:’,‘’&{DESIGN: UNDER REVIEW},LEN(‘’&{DESIGN: UNDER REVIEW})-133)
),‘)’,‘’
))
And what it does is it takes 20 files in one cell and extracts the latest image in on the right to always show in a new field. The issue is that it’s not recognizing some and the URL is blank that I am using the automation.
Does it matter if I have PNG, PDF, MP4, GIF files all in one - wonder if that is causing it to break.
Thank you!
Sep 13, 2022 12:41 PM
Hi @Scott_Gardner1,
I wasn’t able to get your formula to not work.
I slapped together this script to allow you to review all of the URLs in an attachment field, maybe this can help you find your issue
let table = await input.tableAsync('Pick a table');
let field = await input.fieldAsync("Pick a field", table);
let queryResult = await table.selectRecordsAsync({fields: [field]});
let record = queryResult.getRecord(queryResult.recordIds[0]);
output.inspect(record.getCellValue(field));
Sep 14, 2022 03:13 PM
Hi,
On a brief look formula removes closing bracket at the end and searching for ‘http:’ from the position 133 chars back from the end, supposing a single link together with filename can easily fit into this interval, but not two links. Is it dejavu or I wrote something like this some time ago, as a quick fix?
of course, such approximation may sometimes fail when attachment has too long file name.
i have seen a way to find exact position. find number of attachments (by substitute commas or http and then compare length). then use this number in substitute http, fourth parameter (means instead of replace all, replace only given occurence.
but that’s too long, and i was lazy enough to try understanding some regex formulas here. And when i got it (at least part of them),I can change it according to my goal. In your case, it’s
REGEX_EXTRACT({Attachments}, “[^,]*$”)
Sep 14, 2022 08:49 PM
Thank you! I changed the Char to -300 and it worked.