item() function very slow.

item() function very slow.

Hi,.
I want to put a value in the array.
The item()function takes too long in a loop.

IArchiveFilterVariables zenonArchiveVariables = zenonArchiveFilter.Query();

//Get the first available filtered variable
IArchiveFilterVariable zenonArchiveFilterVariable = zenonArchiveFilter.ArchiveFilterVariables().Item(1);
IArchiveFilterVariable zenonArchiveFilterVariable1 = zenonArchiveFilter.ArchiveFilterVariables().Item(0);
IArchiveFilterVariable zenonArchiveFilterVariable2 = zenonArchiveFilter.ArchiveFilterVariables().Item(2);
string[,] saNames = new string[300000, 6];

IArchiveValues t1 = zenonArchiveFilterVariable.ArchiveValues();
IArchiveValues t2 = zenonArchiveFilterVariable1.ArchiveValues();
IArchiveValues t3 = zenonArchiveFilterVariable2.ArchiveValues();
DateTime startTime1 = DateTime.Now;
int EndCount=zenonArchiveFilterVariable.ArchiveValues().Count;
for (int i = 0; i < 30182; ++i)
{

//System.Diagnostics.Debug.Print("value : " + zenonArchiveFilterVariable.ArchiveValues().Item(i).Value);
//System.Diagnostics.Debug.Print("value : " + zenonArchiveFilterVariable.ArchiveValues().Item(i).Value);
//dateT = TimeConversion.ZenOnToSystem((uint)zenonArchiveFilterVariable.ArchiveValues().Item(i).Time).ToString("yyyy-MM-dd HH:mm:ss");
//System.Diagnostics.Debug.Print("state: &H : " + zenonArchiveFilterVariable.ArchiveValues().Item(i).Status.ToString("X"));
//System.Diagnostics.Debug.Print("time : " + dateT);
//System.Diagnostics.Debug.Print("MS : " + zenonArchiveFilterVariable.ArchiveValues().Item(i).TimeMilliSec);


saNames[i, 0] = TimeConversion.ZenOnToSystem((uint)t1.Item(i).Time).ToString("yyyy-MM-dd HH:mm:ss");
saNames[i, 1] = t1.Item(i).Value.ToString();

saNames[i, 2] = TimeConversion.ZenOnToSystem((uint)t2.Item(i).Time).ToString("yyyy-MM-dd HH:mm:ss");
saNames[i, 3] = t2.Item(i).Value.ToString();

saNames[i, 4] = TimeConversion.ZenOnToSystem((uint)t3.Item(i).Time).ToString("yyyy-MM-dd HH:mm:ss");
saNames[i, 5] = t3.Item(i).Value.ToString();
}

DateTime endTime1 = DateTime.Now;
System.Diagnostics.Debug.Print("for result time : " + (endTime1 - startTime1).ToString());

out put : for result time : 34 second

This is a migrated post! Originally posted on 17.05.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