TsgcWSPClient_Dataset

This is Client Protocol Dataset Component, you need to drop this component in the form and select a TsgcWebSocketClient Component using Client Property and select a Dataset Component using Dataset Property.

 

This component inherits from TsgcWSProtocol_Client_sgc all methods and properties.

 

Methods

  Subscribe_all: subscribe to all available channels

 

new: fired on new dataset record.

update: fired on post dataset record.

delete: fired on delete dataset record.

 

  Synchronize: requests all dataset records from the server

 

  GetMetaData: requests all dataset fields from server

 

 

 

Events

  These events are specific on the dataset protocol.

 

  OnAfterDeleteRecord: event fired after a record is deleted from Dataset.

 

  OnAfterNewRecord: event fired after a record is created on Dataset.

 

  OnAfterUpdateRecord: event fired after a record is updated on Dataset.

 

  OnAfterSynchronize: event fired after synchronization has ended.

 

  OnBeforeDeleteRecord: event fired before a record is deleted from Dataset. If Argument "Handled" is True, means that the user handles this event and if won't be deleted (by default this argument is False)

 

  OnBeforeNewRecord: event fired before a record is created on Dataset. If Argument "Handled" is True, means that user the handles this event and if won't be inserted (by default this argument is False)

 

  OnBeforeUpdateRecord: event fired before a record is updated on Dataset.  If Argument "Handled" is True, means that user the handles this event and if won't be updated (by default this argument is False)

 

  OnBeforeSynchronization: event fired before a synchronization starts.

 

  OnMetaData: event fired after a GetMetaData request. Example:

 


procedure OnMetaData(TsgcWSConnection *Connection, const TsgcObjectJSON *JSON)
{
  int i = 0;
  string vFieldName = "";
  string vDataType = "";
  int vDataSize = 0;
  bool vKeyField = false;
  for (int i = 0; i  Count; i++)
  {
    vFieldName = JSON->Item[i]->Node["fieldname"]->Value;
    vDataType = JSON->Item[i]->Node["datatype"]->Value;
    vDataSize = JSON->Item[i]->Node["datasize"]->Value;
    vKeyField = JSON->Item[i]->Node["keyfield"]->Value;
  }
}

 

Properties

   AutoSubscribe: enabled by default, if True, client subscribes to all available channels after successful connection.

 

   ApplyUpdates: if enabled, every time the client receives a dataset update from server, it will be saved on the client side.

 

   AutoEscapeText: if enabled (disabled by default), automatically escape/unescape characters inside field values like "{", "["...

 

   NotifyUpdates: if enabled, every time dataset client changes, it sends a message to server notifying this change.

 

   FormatSettings: allows to set the format of double and datetime fields (to avoid conflicts between diffferent format settings of peers). This format must be the same for server and clients.

 

   UpdateMode: