Expand my Community achievements bar.

SOLVED

I am not getting to use the global variable. Take a look in my form, please.

Avatar

Level 4

Hi.

I am ashamed. I am not able to use a basic function on the LiveCyle: Global Variable / Object.

I have a textfield for the user to put your name. Then the user must to click at the botton. Its name/value should be value for a global variable then I would use this value in all over form.

Look this my example as I would use this value.

https://acrobat.com/#d=k0YlC1MXEdVTh1g2TXAJxw

What's the error? I already tryed to put as global variable, but it doesn't work.

PS: Calling the value using textfield (TextField.rawValue = TextField2.rawValue) , it works very well, but I prefer to use variable

Thanks so much.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi Rafael,

I'm well thanks

I'm not sure if I understand the question, but I think you are asking if it's possible to have a field which displays the value of a global variable (i.e. the "view" you refer to), which is updated automatically via calculation scripts or similar, but not reliant on another event, such as "click"

I believe using a globally bound object is the only way, and you are correct - it is definitely easier.

Please let me know if I haven't understood the question properly

Thanks

Tim

View solution in original post

4 Replies

Avatar

Former Community Member

Hi Rafael

I had a look - you can't use a calculate event on a variable in a javascript object, only if you use another field.

To set the valor2 value, you could change the button click to:

teste.name = valor1.rawValue;
valor2.rawValue = teste.name;

Note - you could also set use the second line in events from other objects

Hope this helps

Thanks,

Tim

Avatar

Level 4

Hi Tim, how are you?

Your solution it works very well!

But, is there another way to view the value of one variable without to set in event click, for example?

Don't need to be a object Fieldtext, can be also, for example, a object Text.

Because, if I use of the way that you showed me, I think is easier to use a global FieldText, for example.

Thank you a lot.

Avatar

Correct answer by
Former Community Member

Hi Rafael,

I'm well thanks

I'm not sure if I understand the question, but I think you are asking if it's possible to have a field which displays the value of a global variable (i.e. the "view" you refer to), which is updated automatically via calculation scripts or similar, but not reliant on another event, such as "click"

I believe using a globally bound object is the only way, and you are correct - it is definitely easier.

Please let me know if I haven't understood the question properly

Thanks

Tim

Avatar

Level 4

Hi Tim.

Thanks for your fast reply.

Exactly  this!

It's a pity I have always to set the value of one global variable through one event as click. If it would work with the object text, it would be perfect!!

Thanks a lot of your attetion
Sorry my English. Here in Brazil I am a English Student yet LOL.
have a nice week

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----