# Assigning Value as the Variable, is it Possible?

**URL:** <https://forum.electroneek.com/t/assigning-value-as-the-variable-is-it-possible/3727>\
**Category:** Studio Pro\
**Created:** [March 14, 2024, 4:57pm UTC](https://forum.electroneek.com/t/assigning-value-as-the-variable-is-it-possible/3727 "2024-03-14T16:57:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_R](https://forum.electroneek.com/letter_avatar_proxy/v4/letter/m/3e96dc/32.png) [@Michael\_R](https://forum.electroneek.com/u/Michael_R)\
**Post date:** [March 14, 2024, 4:57pm UTC](https://forum.electroneek.com/t/assigning-value-as-the-variable-is-it-possible/3727/1 "2024-03-14T16:57:50Z")

</div>

I am trying to set the value as a variable. For clarification I have a value for the variable “lineItem1ProductCode” set as 1111, but I need it to then loop through and input the value for the variable “lineItem2ProductCode”.

I set up an “Assign value to variable” to " `lineItem${t + 1}ProductCode`; " which gives me the value of “lineItem1ProductCode” when t=0.

 ![image](https://forum.electroneek.com/uploads/default/original/2X/c/ca09cd2125263bc9244140cb6acf2a25331bcd35.png)

Is there a way to set a variable to get the value of another Variable using the value of the variable?

---

<div class="post-metadata">

**Author:** ![Michael\_R](https://forum.electroneek.com/letter_avatar_proxy/v4/letter/m/3e96dc/32.png) [@Michael\_R](https://forum.electroneek.com/u/Michael_R)\
**Post date:** [March 15, 2024, 1:19pm UTC](https://forum.electroneek.com/t/assigning-value-as-the-variable-is-it-possible/3727/2 "2024-03-15T13:19:49Z")

</div>

Found out how to change a value and get a value for a variable within a loop so that every time it loops it finds what the value should be.

Using the “Assign a Value” activity I used the code: \_.get(fields, `lineItem${t + 1}ProductCode`, ‘’);

![image](https://forum.electroneek.com/uploads/default/original/2X/e/ecc4f113268f74f085702acc2a986309f8549386.png)
