dataParse - format string

Posted By: Grat

dataParse - format string - 06/07/19 18:32

Hi,

I have data in the csv:

1551356100;rsi_14;7;0;rsi_7;0;9;willr_27;0;9;willr_60;8;0;99.25;99.01
1551357000;rsi_14;6;9;rsi_7;0;9;willr_27;0;9;willr_60;8;0;99.34;99.11
1551357900;rsi_14;5;9;rsi_7;0;5;willr_27;0;9;willr_60;8;0;98.98;97.78

and format string:
string Format = "%t;;i1;i2;;i3;i4;;i5;i6;;i7;i8;f1;f2";

with test:
Code:
for (Row=0;Row<6;Row++){
   printf("n  %s", strdate("%Y-%m-%d %H:%M", dataVar(nHandle,Row,0)));
   for (i=1;i<10;i++)
      printf(" %d",dataInt(nHandle,Row,i));
    
}



2019-02-28 12:15 1120305152 1120273695 0 9 0 9 8 0 0
2019-02-28 12:30 1120316948 1120286802 0 9 0 9 8 0 0
2019-02-28 12:45 1120269763 1120112476 0 5 0 9 8 0 0
2019-02-28 13:00 1120288113 1120229130 9 4 0 9 9 0 0
2019-02-28 13:15 1120260588 1120105923 9 3 0 9 9 0 0
2019-02-28 13:30 1120223887 1119966986 9 2 3 9 9 0 0

first 2 integer (red) are missing in the dataset. Know anybody, where I have bug?

Thanks Milan
Posted By: Spirit

Re: dataParse - format string - 06/08/19 16:54

f1, f2 is overwriting i1,i2
Posted By: Grat

Re: dataParse - format string - 06/09/19 06:09

No,

dataVar(nHandle,Row,1);
dataVar(nHandle,Row,2);

return correct value.

I found the solution:

[code]

string Format = "+%t;sss;i;i;sss;i;i;ss;i;i;ss;i;i;f1;f2";
int Records = dataParse(nHandle,Format,InName);

...
...

#define WIF_MAX 3
#define WIF_MIN 4
#define WIS_MAX 5
#define WIS_MIN 6

#define RSIF_MAX 7
#define RSIF_MIN 8
#define RSIS_MAX 9
#define RSIS_MIN 10

var _RSIF_MAX = (float)dataInt(nHandle,id,RSIF_MAX);
var _RSIF_MIN = (float)dataInt(nHandle,id,RSIF_MIN);
var _RSIS_MAX = (float)dataInt(nHandle,id,RSIS_MAX);
var _RSIS_MIN = (float)dataInt(nHandle,id,RSIS_MIN);
var _WIF_MAX = (float)dataInt(nHandle,id,WIF_MAX);
var _WIF_MIN = (float)dataInt(nHandle,id,WIF_MIN);
var _WIS_MAX = (float)dataInt(nHandle,id,WIS_MAX);
var _WIS_MIN = (float)dataInt(nHandle,id,WIS_MIN);

..
..
[code]

this work a correct.
© 2024 lite-C Forums