Passing Data with DataModels
This section explains another way of passing data to and from Actions and Triggers, different than the one explained in
A DataModel is a class (or instance of that class) with multiple data members, that can be understood by the Easybots platform.
The whole data object can be passed to other bots, or just the separate data members.
In code, they are classes decorated with
The members that you want to be available to other bots in the Easybots Studio, should be decorated with
An example of a 'Area
' datamodel, with three data members: AreaMetric
(from the example in "Passing Data"
will be implemented in the following way:
public class AreaDataModel
public int AreaMetric;
public int AreaImperial;
public string AreaText;
The method (Easybots Action) that will return this DataModel will look like this:
public AreaDataModel CalculateSquareAreaDataModel(
[ParameterDescription("x", "The side 'x' in meters", typeof(int), Order=0)]
[ParameterDescription("y", "The side 'y' in meters", typeof(int), Order=1)]
// 'unpack' the input parameters
int x = inputs;
int y = inputs;
// Return values
int metricArea = CalculateMetricArea(x, y);
int imperialArea = CalculateImperialArea(x, y);
string areaAsText = GetText(x, y);
// Construct the return object
AreaDataModel returnObject = new AreaDataModel();
returnObject.AreaMetric = metricArea;
returnObject.AreaImperial = imperialArea;
returnObject.AreaText = areaAsText;
In Easybots Studio, that will result in:
These data members can be used with any other bot, as input to their actions.
Well Done! Now you know how to use the Easybots platform.
You can continue creating solutions and apps, save it to your private stores, or share it with other people.