BenSmith

Help in using updatevalues method

Discussion created by BenSmith on Feb 16, 2013
Latest reply on Feb 21, 2013 by BenSmith

Hi,

 

Some one can help me in using updatevalues method?  I'm trying to save bunch of data in PI Server, but the values are getting lost even if i use insertduplicates.

 

My data size is around 13000, so i created a PIValues object and added all the values with different timestamps.  The calling the updatevalues method, but only very few values are saved in pi server.

 

I thought may be updatevalues was not working properly if large collections passed, so i made it small chunks like 10 values for each call, still i cannot see the complete list in the pi server. 

 

For testing i added only 50 points, but in server i can see around 30 values..and everytime this is getting changed. I'm setting different timestamp for each value and passing insertduplicate const.

 

If i try using update value in a loop, but still this also doesnt work as expected and its very slow.

 

Sample code here,

 
PISDK.PIValues newPiV = new PISDK.PIValues();
                        newPiV.ReadOnly = false;
                        for (int i = 0; i < numrows; i++)
                        {
                            float v = Convert.ToSingle(frm.selectedMatrix.GetElement(i, col));
                            pitime.LocalDate = ldt
;
                            newPiV.Add(pitime, v, null);
                            if ((i+1) % 10 == 0)
                            {
                                newPiV.ReadOnly = true;
                                pi.Data.UpdateValues(newPiV, PISDK.DataMergeConstants.dmInsertDuplicates);
                                newPiV = new PISDK.PIValues();
                                newPiV.ReadOnly = false;
                            }
                        }
                        newPiV.ReadOnly = true;
                        pi.Data.UpdateValues(newPiV, PISDK.DataMergeConstants.dmInsertDuplicates);  

 

 

BTW all the data timestamps are in ascending order.

 

Thanks in advance!

Outcomes