How to fill an array in code

Certainly a stupid question but i do not figure out how to fill an array with predefined values like in this example:
I need to fill the array arr1 with three strings “ONE”, “TWO”,“THREE”.
image

It might better to enter it in the data bindings panel, eg:

image

1 Like

Many thx @TomD, it works perfectly.

1 Like

Tom,
How do i read/query array value(id) such as 1,2,3,4,5 from a database to its corresponding text value e.g progress, pending, resolved etc.

Thanks

Bankym, i may help you if you give some more precision about what you aim to do.
I suppose that you store the status “Progress, Pending etc…” in a table and in a INTERGER field.
For exemple 1=progress, 2=Pending etc … ?
I suppose that you want to display in a table a list of things (maybe orders, or ticket support or anything else) with a column for Status ?

Exactly, “I suppose that you store the status “Progress, Pending etc…” in a table and in a INTERGER field. For exemple 1=progress, 2=Pending etc …”…so when i query/read it, i want to get the actual text to display instead of the ids.

Here is my approach…

  1. Create an array
    image
  2. Fill the array in ARRAY PROPERTIES
    image
    Go in “the Data Binding” and then click on “code” and finally fill the array with your different status in the rigth order.
    image
    ie: [“None”,“progress”,“Pending”,…]
  3. Now, in you table (maybe a bootstrap table), go to the cell properties corresponding to the column “status”, go to “DYNAMIC ATTRIBUTES”->Select “Inner Text”
    image
    and fill like this in the code:
    image
    “array_displaytypes” is the name of my previous array
    “display_1” is the name of the field in my server connection.

Hope it helps.

It does help. Thank you.