prepareValues()

The method prepares the values that were assigned to the method for the upload.

Synopsis

int prepareValues(string msDatapoint, dyn_anytype values, dyn_time times [, dyn_string qualities]);

Parameter Description
msDatapoint MindSphere data point name to which the values are uploaded.
values The values that are uploaded to the MindSphere data point.
times The times of values.
qualities

The quality of values (see the MindSphere documentation for the status codes used).

If you do not enter a status code, the default value "00000000" is used.

Return value

The method returns -1 when the arrays of values and times are of different length or the MindSphere data point is not assigned to this asset. If the method is successfully executed, it returns 0.

Description

The method prepares the values that were assigned to the method for the upload. The method prepares the internal mapping for the upload of values.

The method creates an internal mapping that is used for the upload method. This way you can, for example, use the result of a dpGetPeriod query directly for the MindSphere upload and it must not be parsed manually (see mcUploadValues). The prepared values are deleted from the mapping after a successful upload.

When re-uploading a timestamp to the MindSphere Server, the previously uploaded timestamp and all values it contains will be deleted. This is a limitation of MindSphere and not of WinCC OA.

Example
#uses "classes/mindSphere/MindSphereAsset"

void main()
{
  string dp = "NameOfMindSphereAsset"; /* This MindSphere Asset must already exist in WinCC OA. */
  MindSphereAsset assetX = MindSphereAsset(dp);
  //shared_ptr can also be used
  //shared_ptr<MindSphereAsset> assetPtr = new MindSphereAsset(dp);
  dyn_int values1, values2;
  dyn_time times1, times2;
  string dpe1 = "validDPEName1"; //must be changed to a real DPE with archived values
  string dpe2 = "validDPEName2"; //must be changed to a real DPE with archived values
  string msDp1 = "MindSphereDatapointName1";
  string msDp2 = "MindSphereDatapointName2";
  dpGetPeriod(getCurrentTime()-1000, getCurrentTime(), 0, dpe1, values1, times1, dpe2, values2, times2);
  int err = assetX.prepareValues(msDp1, values1, times1);
  DebugTN(err);
  err = assetX.prepareValues(msDp2, values2, times2);
  DebugTN(err);
  //int errPtr = assetPtr.prepareValues(msDp1, values1, times1);
  //DebugTN(errPtr);
  //errPtr = assetPtr.prepareValues(msDp2, values2, times2);
  //DebugTN(errPtr);
}                   

Assignment

MindSphere

Availability

UI, CTRL