Hi,
I am using a Case statement to create a new field whose values depend on certain other fields taking other value.
So, the new field I am creating is called "XYZ".
For events whose field "Planned Migration Completion Iteration" has a value beginning with "Decom by", then the "XYZ" field would have a value of "Done".
Similarly, for events whose field "Migration Comments" has a value equal to "In progress", then the "XYZ" field would have a value of "In progress".
Finally, for all other scenarios, the XYZ takes the value of "Not Started".
However, this is what my current Case statement looks like, where it ONLY outputs the "Not Started" case:
Can you please help?
Many thanks 🙂
@POR160893 - Use single quotes for field names with spaces. Also * does not work with if eval statement, so use the like() function instead.
| eval xyz=case('Planned Migration Completion Iteration'==like("Decom by%"), "Done", 'Planned Migration Completion Iteration'=="In progress", "In progress", 1==1, "Not Started")
I hope this helps!!!
@POR160893 - Try:
| eval xyz=case(like('Planned Migration Completion Iteration', "Decom by%"), "Done", 'Planned Migration Completion Iteration'=="In progress", "In progress", 1==1, "Not Started")
I hope this helps!!!
Hi @POR160893,
you should try this approach to adapt to your real case:
index=your_index
| eval xyz="Not Started"
| eval xyz=case("Planned Migration Completion Iteration"=like("Decom by%"),"Done", "Planned Migration Completion Iteration"="In progress","In progress")
| table xyzotherwise, you could try something like this:
index=your_index
| eval xyz=if("Planned Migration Completion Iteration"=like("Decom by%"),"Done", if("Planned Migration Completion Iteration"="In progress","In progress","Not Started"))
| table xyzOne hint, don't use field names with spaces, eventually rename them as last row but use field names without spaces.
Ciao.
Giuseppe
and