Multidimensional arrays to functions
deps
Posts: 27
Greetings!
I have a trouble in using function with 4-dimensional array:
define_variable
persistent integer DATA_HOURS[YEARS][MONTHES][DAYS][HOURS]
...
PROCESS_GRAPH(DATA_HOURS[VIEW_YEAR][VIEW_MONTH][VIEW_DATE],length_data)
Function gets an emty array. When I'm trying to copy data into a single dimension array, I get an emty array too:
FOR(I=1;I<=LENGTH_DATA;I++)
DRAW_DATA=DATA_HOURS[VIEW_YEAR][VIEW_MONTH][VIEW_DATE]
But in Debug Watch window I see that array DATA_HOURS is not empty.
Why it happens?
I have a trouble in using function with 4-dimensional array:
define_variable
persistent integer DATA_HOURS[YEARS][MONTHES][DAYS][HOURS]
...
PROCESS_GRAPH(DATA_HOURS[VIEW_YEAR][VIEW_MONTH][VIEW_DATE],length_data)
Function gets an emty array. When I'm trying to copy data into a single dimension array, I get an emty array too:
FOR(I=1;I<=LENGTH_DATA;I++)
DRAW_DATA=DATA_HOURS[VIEW_YEAR][VIEW_MONTH][VIEW_DATE]
But in Debug Watch window I see that array DATA_HOURS is not empty.
Why it happens?
0
Comments
DEFINE_FUNCTION PROCESS_GRAPH(INTEGER gDATA_ARRAY[], integer N_DATA)
Put the following line in PROCESS_GRAPH() to debug it:
SEND_STRING 0, "'PROCESS_GRAPH, LENGTH_ARRAY(gDATA_ARRAY)=', ITOA(LENGTH_ARRAY(gDATA_ARRAY))";
If this is the problem then use the command SET_LENGTH_ARRAY before calling PROCESS_GRAPH()
When using SET_LENGTH_ARRAY, length of gDATA_ARRAY is 24, but array consists of zeroes.
length_data=24
SET_LENGTH_ARRAY(DATA_BASE_HOURS[VIEW_YEAR][VIEW_MONTH][VIEW_DATE], LENGTH_DATA)
SET_LENGTH_ARRAY(DRAW_DATA, LENGTH_DATA)
FOR(I=1;I<=LENGTH_DATA;I++)
DRAW_DATA=DATA_BASE_HOURS[VIEW_YEAR][VIEW_MONTH][VIEW_DATE]
PROCESS_GRAPH( DRAW_DATA,length_data)
Thanks for help!