How can I add an item by the variable of itemId?

I want to add or remove an item which id is defined by certain variable (variable #1 for example)
I tried using those scripts:
$gameParty.gainItem($dataItems[$gameVariables[1]], 1)
$gameParty.gainItem($gameVariables[1], 1)
But it didn't work.
But when I use this
$gameParty.gainItem($dataItems[1], 1)
It still gives an item with id#1
Is there any way to do this?
Code:
$gameParty.gainItem($dataItems[$gameVariables.value(VARIABLEID)], AMOUNT);
Basically in order to get the variable value, you have to use $gameVariables.value function.
You were almost correct.

$gameParty.gainItem ($dataItems[$gameVariables.value(1)], 1)
It works!
tnx guys

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-add-an-item-by-the-variable-of-itemid.103575/