How do I use the value of a property from one node as a key on another node?

Hello, I'm trying to do the below and was wondering if it was possible? I'd like to use the property value of a node as a key on another node to get it' value. I've seen how one sets params and then can use the dollar sign within square braces to get a property - but not sure how that would be done here. Thanks in advance

match (p:Product)-[:HAS_FIELD]->(field:FieldConfig)
with *, as fieldName
where field.type = 'important'
return distinct, p.productId,,field.type, p[fieldName] limit 25

Sorry if I not understand, but the provided query seems to work.
That is, if I have a dataset like: create (p:Product {test: 'another'})-[:HAS_FIELD]->(field:FieldConfig {name: 'test', type: 'important'}),
the p[fieldName] return 'another' (in my example case).

Maybe you want to handle a SET clause?
In this case you could use the APOC procedures, in particular the apoc.create.setProperty ,
for example you could set a property with key the value of and value 'whatever':

MATCH (p:Product)-[:HAS_FIELD]->(field:FieldConfig)
WITH *, as fieldName
CALL apoc.create.setProperty(p, fieldName, 'whatever') yield node

@giuseppe.villani you're 100% right, my data was just not correct for the node. Apologies, it does work - thank you for your help :slight_smile: