If statements within a visualisation

Hi, Im pretty new to kibana and wanting some advice on a visualisation i am creating.
I am creating a basic Pie chard with a count of a field in my data structure (whitepaperNameParent).
I want to add some extra complexity so that IF the field contains a specific piece of data then change to point at a different data field to add to the chart (whitepaperChildren.whitepapers[0].name)

Is this possible at all?
Sorry if it is a newbie question, but I have not managed to find any good answers when I've searched.

This is my data structure below:

Hi @Darren_Whitfield,

It's not exactly clear what you want to achieve (full example would be great), but it seems you're looking for scripted fields. You can use Painless scripting language to analyze field values, use conditional statements etc. and then build your visualizations using this new dynamically created scripted field.

If computation you do for scripted field isn't trivial and you process large amounts of data, we usually recommend to "pre-calculate" such fields during ingestion stage instead. Otherwise performance may suffer.

I'd encourage you to experiment with the scripted fields and get back if you still have questions.

Thanks,
Oleg