1 Reply Latest reply on Jun 11, 2018 7:33 PM by swaroop.gantela

    Calculated field to return new names list for fields with multiple entries

    Jessica Singer

      I'm working with weather data and the daily weather conditions are reported with utterly opaque abbreviations (FG+:02 means freezing fog). I'd like to create a calculated field where I can simply rename them: IF [DAILY Weather] = "FG+:02" THEN "Freezing fog", etc. My problem is that some days the weather is multiple things.

       

      Currently my calc is:

       

      IF CONTAINS([DAILY Weather], "FG:01") THEN "Fog"

      ELSEIF CONTAINS([DAILY Weather], "FG+:02") THEN "Heavy fog"

      ELSEIF CONTAINS([DAILY Weather], "TS:03") THEN "Thunder"

      ELSEIF CONTAINS([DAILY Weather], "PL:04") THEN "Small hail"

      ELSEIF CONTAINS([DAILY Weather], "GR:05") THEN "Hail"

      ELSEIF CONTAINS([DAILY Weather], "GL:06") THEN "Glaze"

      ELSEIF CONTAINS([DAILY Weather], "DU:07") THEN "Dust"

      ELSEIF CONTAINS([DAILY Weather], "HZ:08") THEN "Haze"

      ELSEIF CONTAINS([DAILY Weather], "BLSN:09") THEN "Blowing snow"

      ELSEIF CONTAINS([DAILY Weather], "FC:10") THEN "Tornado"

      ELSEIF CONTAINS([DAILY Weather], "WIND:11") THEN "High winds"

      ELSEIF CONTAINS([DAILY Weather], "BLPY:12") THEN "Blowing spray"

      ELSEIF CONTAINS([DAILY Weather], "BR:13") THEN "Mist"

      ELSEIF CONTAINS([DAILY Weather], "DZ:14") THEN "Drizzle"

      ELSEIF CONTAINS([DAILY Weather], "FZDZ:15") THEN "Freeze drizzle"

      ELSEIF CONTAINS([DAILY Weather], "RA:16") THEN "Rain"

      ELSEIF CONTAINS([DAILY Weather], "FZRA:17") THEN "Freezing rain"

      ELSEIF CONTAINS([DAILY Weather], "SN:18") THEN "Snow"

      ELSEIF CONTAINS([DAILY Weather], "UP:19") THEN "Unknown precip"

      ELSEIF CONTAINS([DAILY Weather], "MIFG:21") THEN "Ground fog"

      ELSEIF CONTAINS([DAILY Weather], "FZFG:22") THEN "Freezing fog"

      ELSE ""

      END

       

      But, obviously, this returns only one from this list if the filed contains more than one entry.

       

      How do I get my calc to return this:

       

      FG:01 PL:04 WIND:11 --> Fog, Small hail, High winds

       

      Thanks!

       

      Jessica