Showing results 1 to 3 of 3

Thread: item() function very slow.

  1. #1
    Join Date
    23.02.2016
    Posts
    28

    Default 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)zenonArchiveFil terVariable.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

  2. #2
    Join Date
    23.02.2016
    Posts
    28

    Default Re: item() function very slow.

    i'm try.



    IArchiveValue test1 = t1.Item(i);
    IArchiveValue test2 = t2.Item(i);
    IArchiveValue test3 = t3.Item(i);

    saNames[i, 0] = TimeConversion.ZenOnToSystem((uint)test1.Time).ToS tring("yyyy-MM-dd HH");
    saNames[i, 1] = test1.Value.ToString();

    saNames[i, 2] = TimeConversion.ZenOnToSystem((uint)test2.Time).ToS tring("yyyy-MM-dd HH");
    saNames[i, 3] = test2.Value.ToString();

    saNames[i, 4] = TimeConversion.ZenOnToSystem((uint)test3.Time).ToS tring("yyyy-MM-dd HH");
    saNames[i, 5] = test3.Value.ToString();

    result : endtime: 20 second


    but
    Still too slow .


    I want to process faster.

  3. #3

    Frage Re: item() function very slow.

    Regarding the TimeConversion class...I have the VBA version (clsTimeConvert), but since I'm moving all the code to .NET and I have seen in online help that there are references to also the .NET counter part, do you know where to download it...if it is allowed?

    Thank you.


Similar Threads

  1. Replies: 2
    Last Post: 15th July 2016, 09:22
  2. how to get selected item from commbobox ?
    By backjahyun in forum VSTA
    Replies: 0
    Last Post: 7th April 2016, 01:21
  3. ArchiveValues().Item(i).Value = 0
    By backjahyun in forum VSTA
    Replies: 0
    Last Post: 22nd March 2016, 09:30
  4. Access New CEL item event from VBA
    By karimsaikali in forum VBA
    Replies: 7
    Last Post: 12th March 2009, 08:56
  5. Delete item in a combobox
    By fabios in forum VBA
    Replies: 2
    Last Post: 11th July 2008, 10:43

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •