# Being able to use a value to set the key

**URL:** <https://forum.alumio.com/t/being-able-to-use-a-value-to-set-the-key/787>\
**Category:** Data Transformers\
**Tags:** data-transformer\
**Created:** [October 18, 2023, 12:07pm UTC](https://forum.alumio.com/t/being-able-to-use-a-value-to-set-the-key/787 "2023-10-18T12:07:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![steven](https://forum.alumio.com/user_avatar/forum.alumio.com/steven/32/214_2.png) [@steven](https://forum.alumio.com/u/steven)\
**Post date:** [October 18, 2023, 12:07pm UTC](https://forum.alumio.com/t/being-able-to-use-a-value-to-set-the-key/787/1 "2023-10-18T12:07:23Z")

</div>

When using a `Value setter` it’s possible to use a variable as a key, for instance: `&{PropertyName}`. Works great, unless you have nested data, it does not work for other instances like `List: Extend with supplied data`.  
For example, this will not work:

```auto
{
  "&{PropertyName}": "&{Value}"
}

```

How do you set the keyname using a variable? Or is there another approach?

---

<div class="post-metadata">

**Author:** ![r.candrian](https://forum.alumio.com/user_avatar/forum.alumio.com/r.candrian/32/235_2.png) [@r.candrian](https://forum.alumio.com/u/r.candrian)\
**Post date:** [October 19, 2023, 5:09am UTC](https://forum.alumio.com/t/being-able-to-use-a-value-to-set-the-key/787/2 "2023-10-19T05:09:34Z")

</div>

Hi @steven

Unfortunately, it was impossible to set a key name using variables on instances like `List: Extend with supplied data`. As you already know, it can be done by a value setter.

Currently, I’m checking with the team, I’ll update my answer if we found another approach.

---

<div class="post-metadata">

**Author:** ![r.candrian](https://forum.alumio.com/user_avatar/forum.alumio.com/r.candrian/32/235_2.png) [@r.candrian](https://forum.alumio.com/u/r.candrian)\
**Post date:** [October 19, 2023, 7:34am UTC](https://forum.alumio.com/t/being-able-to-use-a-value-to-set-the-key/787/3 "2023-10-19T07:34:37Z")

</div>

Hi @steven, to make it clear, could you please provide us with a context of your issues?  
Maybe you can tell us with some kind of input, and output expected.

---

<div class="post-metadata">

**Author:** ![steven](https://forum.alumio.com/user_avatar/forum.alumio.com/steven/32/214_2.png) [@steven](https://forum.alumio.com/u/steven)\
**Post date:** [October 19, 2023, 9:48am UTC](https://forum.alumio.com/t/being-able-to-use-a-value-to-set-the-key/787/4 "2023-10-19T09:48:56Z")

</div>

This is the example input:

```auto
{
  "CustomField": [
    {
      "Value": "20",
      "PropertyName": "Something"
    },
    {
      "Value": "50",
      "PropertyName": "Else"
    }
  ]
}

```

I want to output:

```auto
{
  "CustomField": [
    {
      "Something": "20"
    },
    {
      "Else": "50"
    }
  ]
}

```

I currently fixed it with a work around using node transformers, where the pattern doesn’t work 🤔

 ![node alumio](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/2X/7/79584c5d0a4d9b7a25a475981d85448fbcc9d767.png)

---

<div class="post-metadata">

**Author:** ![r.candrian](https://forum.alumio.com/user_avatar/forum.alumio.com/r.candrian/32/235_2.png) [@r.candrian](https://forum.alumio.com/u/r.candrian)\
**Post date:** [October 20, 2023, 9:14am UTC](https://forum.alumio.com/t/being-able-to-use-a-value-to-set-the-key/787/5 "2023-10-20T09:14:47Z")

</div>

Hi Steven,

Please try to use this example.  
You can import this into your environment.  
Let me know if it doesn’t work.

[forum-787-reformat-data\_transformer.ndjson](https://forum.alumio.com/uploads/short-url/vKp7pcXRPCvr1cE4uT31raC25Ik.ndjson) (938 Bytes)

---

<div class="post-metadata">

**Author:** ![steven](https://forum.alumio.com/user_avatar/forum.alumio.com/steven/32/214_2.png) [@steven](https://forum.alumio.com/u/steven)\
**Post date:** [October 20, 2023, 9:50am UTC](https://forum.alumio.com/t/being-able-to-use-a-value-to-set-the-key/787/6 "2023-10-20T09:50:42Z")

</div>

Thanks for your example, I’ve made it even smaller/easier. The big note for me is the `entity transformer` → `node, transform nodes` does something completely different from a `Data, transform data using mappers and conditions` → `Node Transformer`, the pattern does absolutely nothing for a `Node Transformer`.

Here is my setup now:

 ![entity transformer](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/2X/3/3d7611330ba43542579aed0a157aff9047a01035.png)

---

<div class="post-metadata">

**Author:** ![r.candrian](https://forum.alumio.com/user_avatar/forum.alumio.com/r.candrian/32/235_2.png) [@r.candrian](https://forum.alumio.com/u/r.candrian)\
**Post date:** [October 20, 2023, 10:22am UTC](https://forum.alumio.com/t/being-able-to-use-a-value-to-set-the-key/787/7 "2023-10-20T10:22:21Z")

</div>

Yes, because both have different functionality.  
I am glad that you can manage it.  
We try to make another example to avoid a value-setter, since you asked for another approach.
