Page tree
Skip to end of metadata
Go to start of metadata

This function is used to return a list of TRecord from a table in the system

Parameters

Used to call the function

  1. LastModified - DateTime
  2. TableName - string
  3. opt - TRecordOptions

Returns

Returns the following

 

Get Records from Job table
IItemServiceservice recService = new dkWS.IItemServiceservice() { TokenSecurityValue = new TokenSecurity() { Token = token.Token, AppID = token.AppID } };
var recs = recService.GetRecords(new DateTime(2016, 10, 21, 11, 22, 01, 0), "pjjob", new TRecordOptions() { ExtraProperties = new string[] {"RecordID","Number","Name","RecordModified"}, MaxRecords = 100, UseXMLDateTime = true});
Sync Example
        public List<TRecord> GetRecords(DateTime modified, string table , string[] fields)
        {
            List<string> dkField = fields.ToList();
            
            string modfield = dkField.SingleOrDefault(x => x.ToLower() == "recordmodified");
            if (modfield == null)
                dkField.Add("RecordModified");

            List<TRecord> result = new List<TRecord>();
            TRecordOptions options = new TRecordOptions() { ExtraProperties = dkField.ToArray(), MaxRecords = 100, UseXMLDateTime = true, SkipEmptyValues = true };
            List<TRecord> queryList = client.GetRecords(modified, table, options).ToList();
            result.AddRange(queryList);
            while (queryList.Count() > 80)
            {
                string iDateTime = queryList.Last().Fields.Single(x => x.Name.ToLower() == "recordmodified").Value;
                DateTime d2 = DateTime.Parse(iDateTime, null, System.Globalization.DateTimeStyles.RoundtripKind);
                queryList = client.GetRecords(d2.AddMilliseconds(1), table, options).ToList();
            }
            return result; ;
        }


 

 

The name of the modified date in all tables is RecordModified

to start at the table beginning you can set the LastModified as 1.1.1900
to resume and get changed/new TRecord pass the lastmodified date of the last TRecord of a table you recived 

A good practise for the lastModified if sending the highest RecordModified +1ms from the table you are going to sync from

instead of storing your local DateTime to minimize the risk of offsets

Useful function with this one

GetHasRecordChanges is a very useful function if you are getting records from multiple tables
to get information if you need to fetch any added or changed records