Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  12 Jun 2019, Marius Koeppel, Forum, Strange JS array creation 
    Reply  17 Jun 2019, Konstantin Olchanski, Forum, Strange JS array creation 
       Reply  24 Jun 2019, Marius Koeppel, Forum, Strange JS array creation 
          Reply  25 Jun 2019, Konstantin Olchanski, Forum, Strange JS array creation 
Message ID: 1549     Entry time: 12 Jun 2019     Reply to this: 1550
Author: Marius Koeppel 
Topic: Forum 
Subject: Strange JS array creation 
Hello everybody,

I have a strange JS behavior. In one of my frontends I create a key in the ODB with:

db_create_key(hDB, 0, "Equipment/Switching/Variables/DATA_WRITE", TID_INT);

In my custom page I have a JS function which loops over an array and sets the
value of this key with:

for (i = 0; i < lines.length; i++) {
        modbset("/Equipment/Switching/Variables/DATA_WRITE[" + String(i) + "]",
parseInt(lines[i]));
}

After calling this function I have an array in the ODB now. For my understanding
calling an INT like an array shouldn't be possible. So is this dangerous to do?

Best regards,
Marius
ELOG V3.1.4-2e1708b5