Hi, I am having trouble retrieving the correct row for a timeperiod in a dataset. I am using dataParse to read in a csv file and then trying to find the corresponding row for the bar's timeperiod. Here is the code:
to read and parse:
string Format = "%Y-%m-%d %H:%M:%S,f"; int RecordsEUR1H = dataParse(1,Format,InNameEUR1H);
and then:
int RowEUR1H = dataFind(1,wdate());
it returns the attached for this print: printf("n Date: %s, Row: %i, Value: %f",strdate("%Y-%m-%d %H:%M:%S",wdate()),RowEUR1H, dataVar(1,RowEUR1H,1));
It looks as if dataFind returns a record for every 2nd or so timeperiod BEFORE the given date? How can i make sure that it return a record for the exact timeperiod? data for that timeperiod is available in the dataset as you can see.
thanks for the help in advance. I am using Zorro S 1.72 but tried it on S 1.66 and it is the same.
Re: dataFind() does not return the correct row for a timeperiod
[Re: Tamas]
#470135 12/28/1711:0212/28/1711:02
I have shifted the wdate() value with 1 second to go over the hour and now it finds the correct value based on the time just 1 second before that. so I overcome the above issue, but still would be interested to find out why the exact match with datafind does not work.
Last edited by Tamas; 12/28/1711:03.
Re: dataFind() does not return the correct row for a timeperiod
[Re: Tamas]
#470138 12/28/1711:4012/28/1711:40
I assume that wdate() was not exactly on a hour boundary, but still, the 1 second shift should normally not be necessary. Can you contact support(at)opgroup.de with your script and the CSV file? They'll look into it, maybe the problem is caused by something else.
Re: dataFind() does not return the correct row for a timeperiod
[Re: jcl]
#470143 12/28/1713:2712/28/1713:27
thanks jcl, will drop them an email. btw, how would you compare two DATE type variables to see if that are the same down to only the second? (no milliseconds or below)
Re: dataFind() does not return the correct row for a timeperiod
[Re: Tamas]
#470147 12/29/1708:2412/29/1708:24