Apply length function in string manipulation

Hi @jpages , I found a couple of things that are weird from your screenshot.

  1. You mentioned 2 columns, and you showed “coordinates” and “length” as columns, both string.
    Are you using the “length” column? What does that column represent? Is it different from the results from the function length($coordinates$)? How is that column being used here? If it’s the same results, how is that column created (it should be an int if it’s the length of $coordinates$)?

  2. I’m guessing you are using the String Manipulation? You can’t really do any if conditions in the String Manipulation. For that, you need Column Expressions node instead, that would be your best option. So that “syntax” that you are trying is not working as you expected.

For the Column Expressions, you can use this:

if(length(column("coordinates")) == 33) {
    substr(column("coordinates"), 20, 12)
} else {
    column("coordinates")
}

Note: substr($coordinates$, 20, 12) (or substr(column("coordinates"), 20, 12)) will give you characters from the 21st position up to 32nd position, so you are not taking the last character, if that is what you want.

7 Likes