Is it possible to Set a material using a String ?

Like i’m trying to do here in the yellow bubble:
Basically I have 2 version of the material and i’d like to switch between them organically without having to set them up manually.
If this is impossible i’m open to suggestions.
Thank you for your time !