# Json queries with variables

**URL:** <https://forums.fusetools.com/t/json-queries-with-variables/3674>\
**Category:** How-to Discussions\
**Created:** [April 1, 2017, 4:52pm UTC](https://forums.fusetools.com/t/json-queries-with-variables/3674 "2017-04-01T16:52:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![viktor](https://avatars.discourse-cdn.com/v4/letter/v/d6d6ee/32.png) [@viktor](https://forums.fusetools.com/u/viktor)\
**Post date:** [April 1, 2017, 4:52pm UTC](https://forums.fusetools.com/t/json-queries-with-variables/3674/1 "2017-04-01T16:52:55Z")

</div>

Hi, I am uncreating this incredible tool and decided to apply an application to the json I would like to try to integrate a variable to the string in this way:

```
function saveLenguaReg(arg) {
lenBoton2 = arg.data.lenNombre
textoConf1.value = dataIdioma.value.lenBoton2.tslIni01;
}

```

But I recivo error I would like to know if this is possible and I would appreciate your help.  
(Translated by google sorry)

---

<div class="post-metadata">

**Author:** ![viktor](https://avatars.discourse-cdn.com/v4/letter/v/d6d6ee/32.png) [@viktor](https://forums.fusetools.com/u/viktor)\
**Post date:** [April 1, 2017, 4:58pm UTC](https://forums.fusetools.com/t/json-queries-with-variables/3674/2 "2017-04-01T16:58:51Z")

</div>

My json

```
{"idiTIni":
[
{
    	"lenId": "Esp",
	"lenNombre": "idiomaEsp",
},
{
	"lenId": "Eng",
	"lenNombre": "idiomaEng",
}
],                            
"idiomaEsp":
{
	"tslIni01": "Hola",
},

"idiomaEng":
{
	"tslIni01": "Hello",
}
}
```

---

<div class="post-metadata">

**Author:** ![Enrico](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/enrico/32/144_2.png) [@Enrico](https://forums.fusetools.com/u/Enrico)\
**Post date:** [April 4, 2017, 10:37am UTC](https://forums.fusetools.com/t/json-queries-with-variables/3674/3 "2017-04-04T10:37:49Z")

</div>

This is a Javascript [string concatenation](http://www.endmemo.com/js/strconcate.php) question. Use the `+` operand:

```
dataIdioma + lenBoton2 + tslIni01

```

P.S. Please, when you write code in your post, add 4 white spaces at the beginning of the line to format the code as done in the above line.

---

<div class="post-metadata">

**Author:** ![viktor](https://avatars.discourse-cdn.com/v4/letter/v/d6d6ee/32.png) [@viktor](https://forums.fusetools.com/u/viktor)\
**Post date:** [April 6, 2017, 3:30am UTC](https://forums.fusetools.com/t/json-queries-with-variables/3674/4 "2017-04-06T03:30:35Z")

</div>

I really appreciate your time and response  
Already try to concatenate the string in many ways including

```
 TextConf1.value = dataLanguage + lenBoton2 + tslIni01;

```

Admeas of:

```
TextConf1.value = dataLanguage.data + "." + LenBoton2 + "." + TslIni01;
TextConf1.value = "datadata.data." + LenBoton2 ".tslIni01";

```

And I can concatenate the value  
I just want to get the result that gives me this string.

```
TextoConf1.value = dataLanguage.value.language.tslIni01;

```

This string goes to json and looks for the correct value  
I need to be able to change the languageEsp value by lenBoton2 to be able to do a json that when modifying add more languages and no option gave me the result, I would appreciate it if you took a little time to take a look:

---

<div class="post-metadata">

**Author:** ![viktor](https://avatars.discourse-cdn.com/v4/letter/v/d6d6ee/32.png) [@viktor](https://forums.fusetools.com/u/viktor)\
**Post date:** [April 6, 2017, 3:33am UTC](https://forums.fusetools.com/t/json-queries-with-variables/3674/5 "2017-04-06T03:33:03Z")

</div>

Separate in a single file the part with which I have problems I hope it is simpler to get me to understand the idea:

```
<App>
<JavaScript>
    var Observable = require("FuseJS/Observable");
    var Bundle = require("FuseJS/Bundle");
    var dataIdioma = Observable();
    var textoConf1 = Observable();
    var lenBoton2 = Observable();
    var tslIni01 = Observable();

    Bundle.read("Sjson/jIdiomaGral.json").then(function(leguajetab) {
        var lenguadata = JSON.parse(leguajetab);
        dataIdioma.value = lenguadata;
    });

	function saveLenguaReg(arg) {
	 lenBoton2 = arg.data.lenNombre
	 textoConf1.value = dataIdioma.value.lenBoton2.tslIni01;
	}
    module.exports = {
        tslIni01: tslIni01,
        dataIdioma: dataIdioma,
        textoConf1: textoConf1,
        saveLenguaReg: saveLenguaReg, 
        lenBoton2: lenBoton2
	};
</JavaScript>
	<Panel>
		<DockPanel>
			<Rectangle Dock="Bottom" Height="70" >
		    	<Text Value="{textoConf1}"/>
		    	<Rectangle Color="#DDDDDD" />
			</Rectangle>
		    <ScrollView>
        		<Grid ColumnCount="1">
        			<Each Items="{dataIdioma.idiTIni}">
                    	<Panel Clicked="{saveLenguaReg}">
	                        <Text Value="{lenNombre}" Margin="20" />
	                        <WhilePressed>
    	                        <Scale Factor=".95" Duration=".08" Easing="QuadraticOut" />
        	                </WhilePressed>
	                    </Panel>
    			    </Each>
        		</Grid>
    		</ScrollView>
		</DockPanel>
	</Panel>
</App>

```

Thank you
