Trimming Lookup Table Column to Text

Hey Makers!

I am currently seeking an elegant formula to trim a Lookup column to a text value like the "DesiredText column in this:

I tried the ToText() and it returns the two values as text but with a space in between. I have tried the trim formula but it didn’t shave the space in the middle. Ultimately, I have a pack that uses parameters “text1,text2,text3” and want to use a lookup column to feed that formula.

I found a way to do Concatenate like this -

hi @Thomas_Baucom , I would like to suggest two steps to solve this:

first an extra column in the source table, next the usage of listcombine, please see below

and next the listcombine based on the text values

hope it helps, Cheers, Christiaan

2 Likes

Oh! I like that, @Christiaan_Huizer! Once you have the ListCombine() and it returns “Bob, Thomas”, is there a way to easily trim out the space after the comma? I figured it out up top but it took a bunch of helper columns which isn’t usually my style.

You can always use:

value.regexReplace("\s","")

That should replace any and all spaces with a blank value.

You could also likely do this:

3 Likes

@Scott_Collier-Weir you always have the most elegant solutions. That worked beautifully. Thanks!

The correct way is to Name.Name.Join(",") — i.e. take the actual text values and join these, NOT flatten row references to text with ToText().

2 Likes

I think join() is ‘flattening’ the field values to text anyways, so you might as well use Name.join(",") or, if you want to keep a space use Name.join(", "), or Name.trim(), or anything else the ‘flattens’ the objects. And I don’t see what would be wrong with Name.totext()?

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.