Hi experts, I want to just combine these location sites - "HU1","IA2","IB0 and create new AM site.
I tried this query, it works but it shows only new site. How to see the all original sites along with the new site in location field?
|search location IN ("HU1","IA2","IB0")
|eval row=if(location IN ("HU1","IA2","IB0"),"AM",location)
|stats c by row.
How to solve any idea?
When describing a problem, make sure to use consistent terms and explain new terms as you introduce them. I assume that "original sites" means "HU1","IA2", and "IB0". Is this correct? The search logic seems opposite to what you are looking for. Try this:
|search location IN ("HU1","IA2","IB0")
|eval row=if(location IN ("HU1","IA2","IB0"),location,"AM")
|stats c by row.
@yuanliu Let's assume for example in my data I'm having loction sites - AB,AC,AD,AF. I want new location that is AM. Where AM location should be the combination of (AB,AC,AD,AF)
Like this i need:
I tried this query as you mentioned earlier, but it doesn't work.
location that is AM. Where AM location should be the combination of (AB,AC,AD,AF)Like this i need:
First, "the combination of (AB,AC,AD,AF)" is NOT "AM" in your illustration. The illustration is the opposite of what you described. (Also, please use text table instead of screenshot.)
Second, for your initial question, I notice that you filter for "HU1","IA2","IB0". Of course you will only get whatever definition you give for these three. I think what you wanted is
``` |search location IN ("HU1","IA2","IB0")```
``` ^^^ no filtering ```
|eval row=if(location IN ("HU1","IA2","IB0"),location,"AM")
|stats c by row
But back to your new example. Here is an emulation
| makeresults format=csv data="Location
AB
AC
AD
AE
AF
AG
AH"
``` data emulation above ```
| eval "New Location" = if(Location IN ("AB","AC","AD","AE","AF"),Location,"AM")
Location | New Location |
AB | AB |
AC | AC |
AD | AD |
AE | AE |
AF | AF |
AG | AM |
AH | AM |
Is this what you illustrated?