Expand my Community achievements bar.

SOLVED

myArray is not behaving as GLOBAL scope?

Avatar

Level 8

Hello

I want to have a Array declared in the form, and that Array should VISIBLE to every where of the form.

Meaning, i can use tthat aray in every page, every subform, every text field to append the elements

And to loop that array in some button (on click event).

PLs. let me know how can i declare a array that is GLOBAL in scope, really global? at what level i hv to declare it? at root node level (say, my form name is VISITORinfio, so, keeping curson on this node and declaring array in readDoc event? )

I tried with these options but not working at all!!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Srinivas,

  I tried on my system and its working!! Try creating a global variable with the help of menu : Form -> Properties -> Variables (Tab)

name the variable a1.

Now go to any text field or form initialize event and write

form1.Page1.TextField1::initialize - (JavaScript, client)

a1[0] = "name1";

a1[1] = "name2";

//when you assigned the variable like a1[0], it automatically presumes it is a array.

Now any click event of a button or the event you want to get the values assigned to this array,

form1.Page1.Button1::click - (JavaScript, client)

app.alert(a1[0]);

app.alert(a1[1]);

Let me know if you see any difficulties in using the global array.

kc

View solution in original post

5 Replies

Avatar

Level 8

Pls. help me that let me know how to declare a GLOBAL SCOPE array(i did by using var, with out var key word, i did at TOP level, even i dont hv any functions!) - Thank you

Avatar

Former Community Member

Hi Srinivas,

   Did you try declaring a global variable using File -> form properties -> Variables (Tab).

I know that the scope of these variables is global. But i'm not sure it can be used as an array or not.

----

kc

Avatar

Level 8

Sorry, its not working!!

I dont understand, why adobe made this simple & popular(every one needs to hv an array with a GLOBAL scope) requirement so complicated? i searched in the google, but, did not find any workabale solution.

Thank you    

Avatar

Correct answer by
Former Community Member

Srinivas,

  I tried on my system and its working!! Try creating a global variable with the help of menu : Form -> Properties -> Variables (Tab)

name the variable a1.

Now go to any text field or form initialize event and write

form1.Page1.TextField1::initialize - (JavaScript, client)

a1[0] = "name1";

a1[1] = "name2";

//when you assigned the variable like a1[0], it automatically presumes it is a array.

Now any click event of a button or the event you want to get the values assigned to this array,

form1.Page1.Button1::click - (JavaScript, client)

app.alert(a1[0]);

app.alert(a1[1]);

Let me know if you see any difficulties in using the global array.

kc

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] ----