Skip to Content
author's profile photo Former Member
Former Member

Values loading in data binding

Hello experts,

I am working in DS 1.5.

I'd like to use data binding to get the value_1, and then calculate it to get value_2, I set the code "On Startup" like following :

but it seems to have the problem of sequence about values' loadings in data binding, because the value of value_2 is always "-1", no matter how much the value_1 is. If I use the same code in "On Click" of TEXT_5, when we click TEXT_5, the result is correct, but what I need is TEXT_5 will display the correct value without click. So how can I arrive at it? Would you please give me some advice?


Thanks a lot!


Best regards,


Ying

data binding.jpg (13.3 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2015 at 12:46 AM

    Hi Ying,

    I think we cannot control when the data binding is executed.

    To realize the same effect, you can use getData instead.

    On startup:

    var value_1=DS_1.getData("AMOUNT_SOLD", {"YR": "2003"}).value;

    var value_2=value_1-1;

    TEXT_5.setText(""+value_2);

    Best,

    Alfred

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 13, 2015 at 05:15 AM

    Hi Ying,

    The problem might be TEXT_4.getText() returns you empty on startup. because no value has been selected hence always returns -1 in value_2. It works fine when you on-click the text because, now it have the value for TEXT_4.getText(). Just try the way Alfred suggested.

    Thanks,

    Nithyanandam

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.