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.
Disclaimer
This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.
The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.
Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.
Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.
COPA-DATA reserves the right to change this document from time to time at own discretion.
Ing. Punzenberger COPA-DATA GmbH
Karolingerstraße 7b · 5020 Salzburg · Austria
www.copadata.com