Column expressions IF STARTSWITH

Hi,

I’m trying to add a character to an invoice number in a list. If the invoice number starts with a 9 the letters “IT” should be added, in other cases the letter “P” should be added. I’m trying to get it to work in columns expressions, but I can’t find a solution to check with what character a string starts.

Thanks,
Rob

Hi @robvp , you can use the left(str, n) function to find the leftmost n characters in a string:

something like this:

if (left(column("InvoiceNumber"),1 )=="9")
{
    column("InvoiceNumber") +"IT"
}
else
{
    column("InvoiceNumber") +"P"
}

There is also the substr(string,start,length) to find a substring beginning at start position, consisting of length characters, where the first character is at start-position 0

2 Likes

Great, that worked!! Thanks! :slight_smile:

1 Like

Glad that you already found a solution.
Alternatively you could use string manipulation with the “questionmark syntax” as far as i can remember.
br

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