So I’m trying to simplify a physcial address, for example:
3 Fred St, Fred Town QLD 4352, Autralia - 3 Fred St, Fred Town
I’ve used the following Expression:
{{ $node[“Find New Bookings”].json.location.slice(0,$node[“Find New Bookings”].json.location.indexOf(" QLD")) }}
This works perfectly UNTIL the address is already in the simplifed format in which case the final result of the expression is -1 so you end up with:
3 Fred St, Fred Tow
How can I change the expression so it doesn’t delete the last character if the " QLD" is not found?