RPStepResult
The result from a RPStep.
- Inheritance
-
- Object
- Serializable
- RPResult
- RPStepResult
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
RPStepResult.fromJson
RPStepResult
- required String identifier,
- required String questionTitle,
- required RPAnswerFormat answerFormat,
Create a RPStepResult with a given identifier and an empty map of results.
It sets startDate to the DateTime.now(). Since these objects are instantiated together with the Step it belongs to so it can be used for measuring how much time the participant spent the given Step.
Constants
DEFAULT_KEY
The default key for the results map. It's used when there's only one answer result. In that case the result value is saved under this key in the map.
Properties
answerFormat
The Answer Format (RPAnswerFormat) which generated this result.
It stores the details about the question (e.g. the available choices) therefore it's necessary for understanding the value of the result which usually doesn't tell a lot in itself.
fromJsonFunction
The function which can convert a JSON string to an object of this type.
questionTitle
The title of the question.
It is set by the RPStep and RPUIFormStep so it's easier to trace back this answer result from the step that initiated it.
results
The map of results with a string as identifier and generic type as value.
Methods
getResultForIdentifier
- String identifier
Returns result value for the given identifier from the results map
setResult
- dynamic result
Creates an entry for the results map with the default key.
Usually it's used when there's only one result produced by the Question Body
setResultForIdentifier
- String identifier,
- dynamic result
Adds a result to the result map with the given identifier.
Used when the result is not a traditional answer result (e.g. signature result). Also used at Form Steps where there are multiple questions asked during a single step.
toJson
Return a JSON encoding of this object.