Under review

Clarification of the Register-Contribution function

Liam Schulz 4 months ago updated by Matthew Davis (Technical Product Manager) 4 months ago 1


Just seeking some clarification about how the "Register-Contribution" functions on PowerShell Schema transformations and what scenarios this applies to.

For example, if I have 2 fields Field1 and Field2 and apply the function like: "Register-Contribution Field1 Field2". Does this mean that a change to Field1 will trigger reprocessing changes of any transformations for Field2?

Also, would I be correct in assuming that this can be used to help process Time Offset Flag transformations where there may not necessarily be a change to retrigger evaluation of the flag?


Under review

Hey Liam,

There's a good explanation on this ticket which might help: https://unifyvoice.userecho.com/communities/6/topics/5330-time-offset-flag-not-re-evaluated-when-current-time-passes-source-field-timestamp 

But essentially Field1 is a field you're creating with your powershell schema, and Field2 is an existing field which is used in calculating the result of Field1. You can call Register-Contribution multiple times on the same field, if more than one field contributes to it (see the detail at the bottom of this response)

The main use case for this is to allow automatic change detection through powershell transformations. Prior to this feature, the Broker change detection engine didn't know what the powershell script was doing - which fields were being used, and which fields were being output. Therefore, it had no way of knowing whether a change for a field should result in a change for another field. 

So if you're using time offset flag transformations, where the input to your transformation is the result of a powershell script, then yes - this feature is the main use case. If you're using a time offset flag transformation with normal field mappings, then this transformation should already generate future dated changes for reprocessing even if there's no other adapter changes to trigger this.

It was something added as a patch in 5.3, and we've yet to do a documentation pass to add updated doco for it (we've got a draft ready for 6.0)

Some more technical detail on the contribution specifically which might help:

The signature of Register-Contributionis:

Register-Contribution -fieldName <string> -contributingField <string>

where fieldName is the name of the new field created with New-Field, and contributingField is the name of a pre-existing field that contributes to the new field in some way. This can be called multiple times for new fields that are contributed to from multiple pre-existing fields.

For example:

New-Field 'convertedValue' 'int';
New-Field 'joinedTS' 'timestamp';

Register-Contribution 'convertedValue' 'origValue';
Register-Contribution 'joinedTS' 'date';
Register-Contribution 'joinedTS' 'time';

Note that for most, normal usage of the PowerShell conenctor it won't be necessary to register field contributions. Time Offset Flag and Business Day Offset Flag transformations which use generated fields are the main reason why this would be needed.