3 Answers
- Newest
- Most votes
- Most comments
0
I found the way, below a sample query...
fields @message
| filter @message like 'userDetails'
| parse @message "<platform>M</platform> as platformCode
| fields replace(platformCode, "M", "Mobile Native") as platform
| display platform
answered 5 months ago
0
How could I make it work when I have four platform codes?
fields @message
| filter @message like 'userDetails'
| parse @message "<platform>*</platform> as platformCode
| fields replace(platformCode, "N", "Native") as platform
| fields replace(platformCode, "W", "Web") as platform
| fields replace(platformCode, "A", "Android") as platform
| fields replace(platformCode, "I", "iPhone") as platform
| display platform
This display things like...
'WWAndroidI'
Each replace line is adding a single character.
Any ideas?
I thought there would be some sort of 'if' command so I could do some conditional like if(platformCode = "N", "Native") or similar thing.
answered 5 months ago
0
I finally made it work...
fields @message
| filter @message like 'userDetails'
| parse @message "<platform>*</platform> as platformCode
| fields if(platformCode = "W", "Web", if(platformCode = "A", "Android", if(platformCode = "I", "iPhone", ""))) as thePlatform
| display thePlatform
answered 5 months ago
Relevant content
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 years ago
This didn't work as I expected since I have a few codes to check for. If you have one single code to replace, then it will work fine.