Search code examples
workflowformulaalteryx

Alteryx and Formula


I have a series of numers that start with either 8 or 9, I would idealy like to categories these so for exable if starts with 8 change desctription to A if starts with 9 change description to B

Hopefully this makes sense, thank you for any help


Solution

  • The believe following expression should work...

    IIF(StartsWith(ToString([field]),'8')),'A','B')
    

    IIF is an abbreviated IF... the longer form works just as well:

    IF (StartsWith(ToSting([field]),'8')) THEN
        'A'
    ELSE
        'B'
    ENDIF
    

    Also, the switch statement could be utilized also ...

    Switch(Left(ToString([field]),1),
        '?',
        '8','A',
        '9','B')
    

    There are probably other approaches too.