Here's an example I already had built from years ago comparing a text object to a value. That text object could be tied to your datalinq or you can use a datalinq block.

Alternatively you can script something like;
dim Slab as xpSlabObject
dim Blu, Red, Grn as xpMaterial
dim Value as xpTextObject
self.GetObjectByName("Slab1",Slab)
self.Project.GetMaterialByName("Blue",Blu)
self.Project.GetMaterialByName("Red",Red)
self.Project.GetMaterialByName("Green",Grn)
self.GetObjectByName("Text1", Value)
if Value.Text = "Blue"
Slab.SetMaterial(1,Blu)
else if Value.Text = "Red"
Slab.SetMaterial(1,Red)
else
Slab.SetMaterial(1,Grn)
end if
------------------------------
Simon Redmile
Senior Graphic Programmer & Designer
Ross Video
Bristol United Kingdom
------------------------------