Error trying to print array variable in RabbitWeb

I want to print out a structure member from an array and RabbitWeb gives me a "ZHMTL ERROR: Unknown variable error. The variables are declared globally and registered via the #web command.


struct meas1_type {
   char year;
   char mon;
   char mday;
   char hour;
   char min;
   char sec;
   char rh;
   char temp;
} meas1 [MEAS1_SIZE];
#web meas1;
int  idx1 = 0;
#web idx1;

Here is applicable portion of the RabbitWeb script:


idx =                    << OK

  IdxTimeTempJumid
               << OK
  :
      :      << Error
        << Error

The “print($idx1)” and the “print($meas1[0].hour” execute correctly. The two “$meas1[$idx1].xxxx” outputs have the errors. I have used “$meas1[$A].xxxx” in the past with a loop with no problems.
Why is RabbitWeb throwing an error for $meas1[$idx1].xxxx"?

I’m pretty sure that’s a limitation of RabbitWeb. I think you can only use loop variables to index into arrays, but you’d have to double-check the documentation on that.

You could possibly create another RabbitWeb variable as a pointer to one of the meas1 entries. Update that instead of (or in addition to) updating idx1, and then reference the record that way ($curmeas->hour).

If RabbitWeb doesn’t allow the use of pointers, then you’d have to make a copy of “meas1[idx1]” into “curmeas” whenever idx1 changes, and reference the fields as “$curmeas.hour”.