Bases: Easy way to join a list of links with a custom separator

Use case or problem

Properties that contain a list of links, and formulas that return a list of links, cannot be easily joined with a custom separator. Using .join() will cause .toString() to be called on the links, which breaks them.

Proposed solution

Several solutions are possible. The most powerful/flexible, but also complex, would be to make .join() work correctly in this case. This would probably require introducing a new data type to hold formatted text.

For a simpler solution, a configuration parameter could be added, either at the view level or at the field level. At the field level, it could work like displayName:

properties:
formula.listOfLinks:
displayName: "List of Links"
separator: ", "

Current workaround (optional)

It is possible to transform the original list by inserting the desired separator using a formula. This does not support equally well all separators (bases will add a space on each side of the separator, so a separator like a comma will look wrong, although dashes and slashes will be OK), and requires the user to come up with a complex formula for what should be a mundane task.

For reference, the simplest I have been able to come up is the following: myList.map(if(index == myList.length - 1, [value], [value, “|”])).flat().

1 Like

Thank you for this workaround - it looks like it does something I have been wishing for for some time - however, I have no idea what to do with it :blush: I tried making it a Properties > formula in my base - but it is invalid there. Can you help a struggler please?

Looks like the forum software put typographical quotes in my code. Use regular quotes instead.