If you are designing views on the OMS dashboard you rely on collected events. There are times when you want to parse values and only use parts of the field values. But how can this be done if data is already collected? Read on!
I will use my Tesla Supercharger view as an example. I blogged about it some months ago, but you can use any other collected data as well to go through the process. This is one of the collected events:
Pay special attention to the property “Name_s”. This is the City and State of a Supercharger. Both values are separated with a comma. Based on those events I created some custom views:
This is the exact query I used for this example:
Type=TeslaSuperchargerData_CL (Status_s=CONSTRUCTION or Status_s=PERMIT) | measure max(StallCount_d) by Name_s
And the columns are configured like this:
OK, it seems the query pulls back all TeslaSuperchargerData for Superchargers with a specific status. Each Supercharger is listed with its name, but the columns is named “Location” to make it easier to understand. As mentioned, the name/location is in format “City, State”. As the data was collected that way one could think that this is exactly what we need to display and that it cannot be changed.
But hey, this is where the “Name & Value Separator” comes into play. It allows us to configure a delimiter to parse and separate the value into multiple chunks. Let’s try.
- First I define the delimiter as “,” and hit “Apply”. The values in the list are ultimately parsed and everything after the comma is gone.
- Next, to bring back the gone values after the delimiter, I need to reconfigure the columns names. As the values are split now, I will name the columns “City” and “State”. Again, after hitting “Apply”, the column names are added and the missing column is back with the appropriate values.
With that simple trick you can parse values in a list and separate them into multiple columns as needed. Simple but effective. Have fun!