calculated field - if value starts with .. select this: SOLVED

Hi,

i have a question about calculated fields.

Use Case is: We'd like to cluster living-areas. 

Therefore i need something like a calculated field thats selects for example Reagion1 if the zipcode in the linked field/module starts with 3.

Thanks!

Parents Reply
  • Hi Lennart Gebauer,

    this requires a transformation of the textvalue into float.

    The following formula will to the trick but requires a second field (that does not need to be in the layout)

    It looks like this:

    What did I do?

    Initially I pulled the first two characters from the zip code field into the copyzip_c float field with this formula

    subStr($billing_address_postalcode,0,2)

    The field looks like this in studio

    Then I added this formula in my Sales Region field. Most important is the "Sonstige" part to catch all not mathcing results like a zip code that is written like D-44892 etc.

    ifElse(equal($copyzip_c,"10"),"City A",
    ifElse(equal($copyzip_c,"20"),"City B",
    ifElse(isWithinRange($copyzip_c,33,45),"Region A",
    ifElse(isWithinRange($copyzip_c,51,58),"Region B",
    ifElse(isWithinRange($copyzip_c,60,90),"Region C",
    "Sonstige"
    )))))

    Works like a charm!

    Viel Spaß damit :-)

    Cheers

    Björn Canales Pfisterer

    Technical Support Manager

    provalida GmbH

Children