Skip to main content

What's the best way to do an if statement for status codes. Like is status=400, a new field is made statusCode = "Bad Request"

If a one off, use something like this in an evalstatusCode = `status == '400' ? "Bad Request" : statusCode`


you could have a series of those


I was thinking maybe a lookup too, since status codes are pretty much static


Better, more scalable solution IMO is to use a lookup file (under processing, knowledge)statusCode = `C.Lookup('filename.csv','code').match(status,"return_field")`


you can also use the built-in Lookup function


AND mind the type of field status is! Is it a number or a string? You'll need to match the type


Good point, I'll be sure to check on that


lookup is far easier to maintain than the series of if/or statements.


Reply