ArchiveValues().Item(i).Value = 0

ArchiveValues().Item(i).Value = 0

Hi. my function code.
the value is all zeros,Time and the variable name is normal.

public void Macro_testA()
{
IArchive zenonArchive = this.Archives().Item(0);
System.Diagnostics.Debug.Print("archive : " + zenonArchive.Name);
if (zenonArchive == null)
{
//There is no archive, the user will be informed...
this.Parent.Parent.DebugPrint("No archive available!", tpDebugPrintStyle.tpErr);
return;
}
IArchiveFilter zenonArchiveFilter = zenonArchive.ArchiveFilters().CreateArchiveFilter();
for (int i = 0; i < zenonArchive.ArchiveVariables().Count; ++i)
{
//Add every archive variable to the archive filter
zenonArchiveFilter.AddArchiveVariable(zenonArchive.ArchiveVariables().Item(i));
}

//Set the StartTime to 14:00 on the 30th of july 2007
zenonArchiveFilter.StartTime = (int)TimeConversion.
SystemToZenOn(new DateTime(2016, 03, 22, 14, 0, 0));

//Set the EndTime to 11:15 on the 31st of july 2007
zenonArchiveFilter.EndTime = (int)TimeConversion.
SystemToZenOn(new DateTime(2016, 03, 22, 16, 00, 00));

zenonArchiveFilter.StatusMask = 0x41000; //Check only I-BIT + HWERT
zenonArchiveFilter.StatusBit = 0x41000; //Return data if one of those bit is true or both

//Initiate a filter query
IArchiveFilterVariables zenonArchiveVariables = zenonArchiveFilter.Query();


//Get the first available filtered variable
IArchiveFilterVariable zenonArchiveFilterVariable = zenonArchiveFilter.ArchiveFilterVariables().Item(0);
if (zenonArchiveFilterVariable == null)
{
//If there is no variable available, inform the user
this.Parent.Parent.DebugPrint("No filtered archive variable available!", tpDebugPrintStyle.tpNrm);
return;
}
//And if there is, output some details
DateTime dateT;
System.Diagnostics.Debug.Print("Variable : " + zenonArchiveFilterVariable.ArchiveVariable().Name);
for (int i = 0; i < zenonArchiveFilterVariable.ArchiveValues().Count; ++i)
{

System.Diagnostics.Debug.Print("value : " + zenonArchiveFilterVariable.ArchiveValues().Item(i).Value); //The problem is here.
:confused::confused::confused::confused:
dateT = TimeConversion.ZenOnToSystem((uint)zenonArchiveFilterVariable.ArchiveValues().Item(i).Time);
System.Diagnostics.Debug.Print("time : " + dateT);
}


}

my archive setting scan time : 1secnod , saving time 10second format : arx

This is a migrated post! Originally posted on 22.03.2016 by user backjahyun. Please be aware that information can be outdated.