Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, i need to get, from a mashup web application, a variable content.
This variable is computed in this form:
Date(Date(Max([Data Decorrenza]) + 1) + (0 - Sum([Importo Lordo Rata]))/Money(Round(Sum([Importo Lordo Rata]) / Round(max([Data Decorrenza]) - min([Data Decorrenza])))))
the problem is that using the app.variable.getContent, the result is the above expression and not the date value i expect.
Anybody knows how to get the computed variable content?
Thanks
Marco
Hi Macro Puccetti,
Based on the explanation you have given, looks the you have declared a variable with the above expression.
When you use app.variable.getContent ,it it will only return the string value like it has done. For you to get the expression valuated, create a hypercube with one measure and pass the string value from app.variable.getContent to the hypercube and this gives you the calculated values of the expression.
If its just a dimension try using the field list instead of a hypercube.
Hope this is helpful.
Regards,
Sangram Reddy.
But i need to populate an html input field with the computed variable, so which api have i to use?
Can you make me an example?
Another thing on Qliksense when i use the Let statement to set the variables values i've noticed the content of the variable is blank how can be? I need this content into the mashup application.
Thanks
Marco
Hi Marco Puccetti,
Here is what you need.
Firstly declare a variable in your script like this:
Then Create an input box(Or any other element you would like to bind the output to):
Create a hypercube by reffering to your variable:
Update the field in the UI in the function as done above.
You should see the Input field update after the function is updated
Hope this helps.
Thanks and Regards,
Sangram Reddy.
Ok, but i also need an onClick function that allows me to update an input text with a computed variable depending on the first input text variable. Is it possible?
Thanks
Marco
Hi Marco,
As this would be a selection,
Just simply use the below code to trigger a selection inside the previous code :
function(reply){
//....... Your code from after you fetch the data from the hyper cube.
$("#buttonId").click(function() {
app.field("[<Name of the field>]").selectMatch(<Value of the input field>, false);
});
}
This code triggers a selection and hence re-generates the hypercube with the filtered result.
- Sangram Reddy
I have created on qliksense an input text in which i have printed a variable value, so what have i to use to get that field content if i don't know exactly it?
I have tried the selectAll method but i don't find the prototype.
Thanks
Marco
Hi Marco,
Make sure your input box has an ID assigned and then use the below code to fetch the value you have in an input field.
$('#ID').val()
- Sangram
I mean that on Qliksense i have a text field containing a variable value, so i need to get that value in a mashup application within an input file (as showed in the above posts).
Below the screen. How can i obtain what i desire?
Thanks
Marco
Hi Marco,
Ok, So when you input a value into "importo Previsione" field in your mash up, the value in the text field in Qliksense which uses $(m_data_fine_previsione) variable has to be returned. Am I right?
If so,
just replace "qDef": "$(VALUE_Y)" with "qDef": "$(m_data_fine_previsione)".
Now when you click on the "Raggiungibile il" button call this:
$("#buttonId").click(function() {
app.field("[<Name of the field>]").selectMatch(<Value of the input field>, false);
});
Doing this the hypercube gets the respective value for the value provided in the text field in Qliksense by executing the $(m_data_fine_previsione) expression.
If you need the properties of any Qliksense object(As in your case , text of an element ), just make use of :
app.getObjectProperties("CFyDy").then(function(model){
console.log(model);
});
Where "app" = instance of the app in which the object exists in.
Here "CFyDF" is the object ID of the text element in Qliksense.
You can get the ID from the single object browser:
Thanks and Regards,
Sangram Reddy.