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

**URL:** https://community.neo4j.com/t/how-do-i-use-the-value-of-a-property-from-one-node-as-a-key-on-another-node/48708
**Category:** Neo4j Graph Platform
**Created:** [December 8, 2021, 11:15am UTC](https://community.neo4j.com/t/how-do-i-use-the-value-of-a-property-from-one-node-as-a-key-on-another-node/48708 "2021-12-08T11:15:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![joe5](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/joe5/32/21301_2.png) [@joe5](https://community.neo4j.com/u/joe5)
#### Post date: [December 8, 2021, 11:15am UTC](https://community.neo4j.com/t/how-do-i-use-the-value-of-a-property-from-one-node-as-a-key-on-another-node/48708/1 "2021-12-08T11:15:21Z")

</div>

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

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

```

---

<div class="post-metadata">

### Author: ![giuseppe\_villan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/giuseppe_villan/32/11871_2.png) [@giuseppe\_villan](https://community.neo4j.com/u/giuseppe_villan)
#### Post date: [December 9, 2021, 4:06pm UTC](https://community.neo4j.com/t/how-do-i-use-the-value-of-a-property-from-one-node-as-a-key-on-another-node/48708/2 "2021-12-09T16:06:41Z")

</div>

@joe5  
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](https://neo4j.com/labs/apoc/4.1/overview/apoc.create/apoc.create.setProperty/) ,  
for example you could set a property with key the value of `FieldConfig.name` and value `'whatever'`:

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

```

---

<div class="post-metadata">

### Author: ![joe5](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/joe5/32/21301_2.png) [@joe5](https://community.neo4j.com/u/joe5)
#### Post date: [December 10, 2021, 9:19am UTC](https://community.neo4j.com/t/how-do-i-use-the-value-of-a-property-from-one-node-as-a-key-on-another-node/48708/4 "2021-12-10T09:19:22Z")

</div>

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

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