The Data History provides features to track and retrieve changes performed by users on Data Class instances in the context of a Process Instance. It provides a set of functions that can be used inside Appway Solutions,which are described in the following sections.
For complete information on the Data History features, user interface and data models, see the
main article on the feature.
This function starts tracking the given Data Class instance or collection and, recursively, the contained (not yet tracked) elements:
- Data Class instances whose type is a trackable Data Class.
- collections of Primitive values.
- collections of Data Class instances whose type is a trackable Data Class.
If the function is invoked on a Data Class instance or a Collection of Data Class instances whose type is a non-trackable Data Class (not selected for tracking in the Data History configuration, the function fails.
Inputs
(Any) trackingSubject: the Data Class instance or collection to be recursively tracked.
Outputs
(Any) The tracked Data Class instance (for convenience).
This function stops tracking the given Data Class instance or collection and, recursively, the contained tracked Data Class instances and collections.
Inputs
(Any) trackingSubject: the Data Class instance or collection for which tracking should be stopped recursively.
Outputs
Nothing
This function stops tracking the given Data Class instance or collection but does not recurse on the contained tracked Data Class instances and collections.
This is used when the contained tracked Data Class instances and collections should continue being tracked.
Inputs
(Any) trackingSubject: the Data Class instance or collection for which tracking should be stopped.
Outputs
Nothing
This function permanently removes all the changes collected by the Data History (if any) in the context of the specified Process Instance or of the current Process Instance (if none specified).
Inputs
(String, Optional) processInstanceId: The process instance id for which changes need to be removed.
Outputs
None
This function retrieves all the changes collected by the Data History (if any) for the Data Class instance identified by the given entity id. If a property name is specified, only the changes to that property are returned (if any). If no changes are found (either because no change was made or because the Data Class instance or the property was not tracked) an empty Indexed Collection is returned.
Inputs
- (String) dataClassInstanceId: the entity id of the Data Class instance for which changes must be retrieved. The entity id can be obtained by invoking the function DataClass:GetInstanceId() on the Data Class instance.
- (String, Optional) propertyName: the name of the property for which changes must be retrieved.
Outputs
(Indexed DataHistory:DataClassInstanceChange) The list of changes collected for the given Data Class instance (and property).
This function retrieves all changes collected by the Data History (if any) for the Data Class instance identified by the given entity id, after the specified Savepoint. If a property name is specified, only the changes for that property are returned (if any). If no changes are found (either because no change was made after the specified Savepoint or because the Data Class instance or the property was not tracked), an empty Indexed Collection is returned.
Inputs
- (String) dataClassInstanceId: the entity id of the Data Class instance for which changes must be retrieved. The entity id can be obtained by invoking the function DataClass:GetInstanceId() on the Data Class instance.
- (DataHistory:Savepoint) savepoint: Savepoint after which changes must be retrieved.
- (String, Optional) propertyName: the name of the property for which changes must be retrieved.
Outputs
(Indexed DataHistory:DataClassInstanceChange) The list of changes collected for the given Data Class instance (and property) after the specified Savepoint.
This function retrieves all changes collected by the Data History extension (if any) for the Data Class instance identified by the given entity id. Changes are grouped by Savepoint ID. For each Savepoint ID, the returned Named Collection contains an Indexed DataHistory:DataClassInstanceChange collection with all the changes performed after that Savepoint but before the following one. A fictitious Savepoint with ID "START" is added to the Named Collection to list all the changes executed before the first Savepoint in the Process. Consider the following information:
- If the property name is specified, only the changes for that property are returned (if any).
- For an existing Savepoint, if no changes are found (either because no change was made or because the Data Class instance or the property was not tracked), then no entry is added to the Named Collection with that Savepoint ID.
- If no Savepoint exists, an empty Named collection is returned.
Note that, even if change compacting is enabled through the
compacting.enabled configuration property (see
Change Compacting section), changes that occur with at least one Savepoint in between them are not compacted.
Inputs
- (String) dataClassInstanceId: The entity ID of the Data Class instance for which changes must be retrieved grouped by Savepoint. The entity ID can be obtained by invoking the function
DataClass:GetInstanceId() on the Data Class instance. - (String, Optional) propertyName: The name of the property for which changes must be retrieved.
Outputs
(Named Any) Mapping between Savepoint IDs in the Process Instance and the list of changes (Indexed DataHistory:DataClassInstanceChange) related to the given Data Class instance (and property) and executed after that Savepoint but before the following one.
This function retrieves all the changes collected by the Data History (if any) for the collection identified by the given entity id. If an action type (add/update/remove) is specified, only the changes of that type are returned (if any). If no changes are found (either because no change was made or because the collection was not tracked) an empty Indexed collection is returned.
Inputs
- (String) collectionId: the entity id of the collection for which changes must be retrieved. The entity id can be obtained by invoking the function DataClass:GetInstanceId() on the collection.
- (String, Optional) action: the action type for which changes must be retrieved. Available options are: 'ADD', 'UPDATE', 'REMOVE'.
Outputs
(Indexed DataHistory:CollectionChange) The list of changes collected for the given collection.
This function retrieves all the changes collected by the Data History (if any) for the collection identified by the given entity id after the specified Savepoint. If an action type (add/update/remove) is specified, only the changes of that type are returned (if any). If no changes are found (either because no change was made after the specified Savepoint or because the collection was not tracked) an empty Indexed collection is returned.
Inputs
- (String) collectionId: the entity id of the collection for which changes must be retrieved. The entity id can be obtained by invoking the function DataClass:GetInstanceId() on the collection.
- (DataHistory:Savepoint) savepoint: Savepoint after which changes must be retrieved.
- (String, Optional) action: the action type for which changes must be retrieved. Available options are: 'ADD', 'UPDATE', 'REMOVE'.
Outputs
(Indexed DataHistory:CollectionChange) The list of changes collected for the given collection after the specified Savepoint.
This function retrieves all the changes collected by the Data History extension (if any) for the collection identified by the given entity id. Changes are grouped by Savepoint ID. For each Savepoint ID, the returned Named Collection contains an Indexed DataHistory:CollectionChange collection with all the changes executed after that Savepoint but before the following one. A fictitious Savepoint with ID "START" is added to the Named Collection to list all the changes executed before the first Savepoint in the Process. Consider the following information:
- If the action is specified, only the changes related to that action are returned (if any).
- For an existing Savepoint, if no changes are found (either because no change was tracked or because the collection type was not selected for tracking in the configuration, or the collection was not tracked), then no entry is added to the Named Collection with that Savepoint ID.
- If no Savepoint exists, an empty Named Collection is returned.
Note that, even if change compacting is enabled through the
compacting.enabled configuration property (see
Change Compacting section), changes that occur with at least one Savepoint in between them are not compacted.
Inputs
- (String) collectionId: The entity ID of the collection for which changes must be retrieved grouped by Savepoint. The entity ID can be obtained by invoking the function
DataClass:GetInstanceId() on the collection. - (String, Optional) action: The action type for which changes must be retrieved. Available options are: 'ADD', 'UPDATE', 'REMOVE'.
Outputs
- (Named Any) Mapping between Savepoint IDs in the Process Instance and the list of changes (Indexed DataHistory:CollectionChange) related to the given collection and executed after that Savepoint but before the following one.
This function retrieves all the changes collected by the Data History (if any) in the context of the specified Process Instance or of he current process instance (if none specified). If no changes are found (either because no change was made in the context of the Process Instance or because no Data Class instances and collections were tracked), an empty Named Collection is returned.
Inputs
(String, Optional) processInstanceId: The process instance id for which changes need to be retrieved.
Outputs
(Named Any) Mapping between the entity ids of Data Class instances and the collections changed in the current or specified Process Instance, as well as the list of changes (Indexed DataHistory:Change) collected for each of them.
This function retrieves all the changes collected by the Data History (if any) in the context of the current Process Instance after the specified Savepoint. If no changes are found (either because no change was made in the context of the Process Instance after the specified Savepoint or because no Data Class instances and collections were tracked), an empty Named collection is returned.
Inputs
(DataHistory:Savepoint) savepoint: Savepoint after which changes must be retrieved.
Outputs
(Named Any) Mapping between the entity ids of Data Class instances and collections changed in the Process Instance and the list of changes (Indexed DataHistory:Change) collected for each of them after the specified Savepoint.
This function retrieves all changes collected by the Data History extension (if any) in the context of current Process Instance. Changes are grouped by Savepoint ID. For each Savepoint ID, the returned Named Collection contains a Named Any, where the key is the ID of a tracked entity with changes for that Savepoint and the value is an Indexed DataHistory:Change collection containing all the changes for that entity (Data Class instance or Collection) executed after that Savepoint but before the following one. A fictitious Savepoint with id "START" is added to the Named Collection to list all changes executed before the first Savepoint in the Process. Conside the following information:
- For an existing Savepoint, if no changes are found (either because no change in the Process Instance was tracked, or because no Data Class instance or Collection was tracked), then no entry is added to the Named Collection with that Savepoint ID.
- Similarly, entity IDs related to entity with no changes are not returned.
- Finally, if no Savepoint exists, an empty Named Collection is returned.
Note that, even if change compacting is enabled through the
compacting.enabled configuration property (see
Change Compacting section), changes that occur with at least one Savepoint in between them are not compacted.
Inputs
None
Outputs
- (Named Any) Mapping between Savepoint IDs in the Process Instance and the mapping between entity IDs of Data Class instances and collections changed in the Process Instance and the list of changes (Indexed DataHistory:Change) collected for each of them and executed after that Savepoint but before the following one.
This function returns true if at least one change was collected by the Data History for any of the given entity ids of Data Class instances and/or collections. If no changes are found (either because no change was made or because none of the specified Data Class instances and collections were tracked), false is returned.
Inputs
(Indexed String) ids: the entity ids of Data Class instances and collections for which changes must be checked.
Outputs
(Boolean) True if at least one change was collected for the specified Data Class instances and collections, false otherwise.
This function returns true if at least one change was collected by the Data History for any of the given entity ids of Data Class instances and/or collections after the specified Savepoint. If no changes are found (either because no change was made after the specified Savepoint or because none of the specified Data Class instances and collections were tracked), false is returned.
Inputs
- (Indexed String) ids: the entity ids of Data Class instances and collections for which changes must be checked.
- (DataHistory:Savepoint) savepoint: Savepoint after which changes must be checked.
Outputs
(Boolean) True if at least one change was collected for the specified Data Class instances and collections after the specified Savepoint, false otherwise.
This function returns a Named Boolean collection containing as key the ID of each Savepoint of the current process instance. For each Savepoint ID, the value is true if at least one change collected by the Data History extension was executed after that Savepoint but before the following one. A fictitious Savepoint with id "START" is added to the Named Collection to check changes executed before the first Savepoint in the Process. Consider the following information:
- If no changes are found for a Savepoint (either because no change in the Process Instance was tracked or because no Data Class instance or Collection was tracked), then
false is set for the Savepoint ID.
Note that, even if change compacting is enabled through the
compacting.enabled configuration property (see
Change Compacting section), changes that occur with at least one Savepoint in between them are not compacted.
Inputs
- (Indexed String) ids: the entity IDs of Data Class instances and collections for which changes must be checked.
Outputs
- (Named Boolean) Mapping between Savepoint IDs in the Process Instance and a boolean value that is
true if at least one change was collected for the specified Data Class instances and collections after that Savepoint but before the following one.
This function permanently removes all the changes collected by the Data History (if any) in the context of the specified process instance or of the current process instance (if none specified).
Input
(String, Optional) $processInstanceId: The process instance id for which changes need to be removed
Output
Nothing. Permanently removes all the changes collected by the Data History (if any) in the context of the specified process instance or of the current process instance (if none specified).
This function retrieves all Savepoints (if any) added to the current Process Instance. If no Savepoints are found (no Savepoint were added to the Process Instance), an empty Indexed collection is returned.
Inputs
None
Outputs
(Indexed DataHistory:Savepoint) The list of Savepoints added to the given Process Instance.
This function retrieves the Initial State collected by the Data History (if any) for the Data Class instance identified by the given entity id. If no Initial State is found (the Data Class instance was never tracked), null is returned.
Inputs
(String) dataClassInstanceId: the entity id of Data Class instance for which the Initial State must be retrieved.
Outputs
(DataHistory:InitialState) The Initial State for the given Data Class instance.
This function checks if the given Data Class is selected for tracking in the Data History > Tracked Data Classes Studio module.
Inputs
(DataClass:Reference) dataClassReference: the Data Class that must be checked (e.g. DataClass:NewReference('COB:Client')).
Outputs
(Boolean) True if the given Data Class is tracked, false otherwise.
This function retrieves the name of all the properties of the given Data Class which are not tracked by Data History (either because their type is not supported or because they were not selected for tracking in the Data History > Tracked Data Classes Studio module). If the given Data Class was not selected for tracking in the Tracked Data Classes Studio module, an exception is thrown.
Inputs
(DataClass:Reference) dataClassReference: the Data Class for which untracked property names have to be retrieved (e.g. DataClass:NewReference('COB:Client')).
Outputs
(Indexed String) The list of untracked property names related to the given Data Class.