viktor
April 1, 2017, 4:52pm
1
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)
viktor
April 1, 2017, 4:58pm
2
My json
{"idiTIni":
[
{
"lenId": "Esp",
"lenNombre": "idiomaEsp",
},
{
"lenId": "Eng",
"lenNombre": "idiomaEng",
}
],
"idiomaEsp":
{
"tslIni01": "Hola",
},
"idiomaEng":
{
"tslIni01": "Hello",
}
}
Enrico
April 4, 2017, 10:37am
3
This is a Javascript string concatenation 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.
viktor
April 6, 2017, 3:30am
4
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:
viktor
April 6, 2017, 3:33am
5
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