Plug-in (Function & Smart Service)Free

Dictionary Manipulation

by Appian Corporation

Description

NOTE: This plug-in is deprecated and no longer recommended for use for sites running on Appian 21.4 or later. The functionality of this component is available in Appian without installing the plug-in. You can use a!update() and a!keys() in Appian 21.4 or later. Reported by Isaac Dweck.

Dictionaries are one of the most useful data structures available in Appian. Out of the box there are are a limited set of tools that allow you to create and maintain dictionaries, the limitations of which make the job quite cumbersome. This plug-in provides tools to dynamically create dictionaries from key-value pairs, update dictionaries with new values (including nested dictionaries), and understand what keys are available in a dictionary to help with dynamic control.

Features

Functions: createDictionary - Takes a list of keys (Any Type) and a list of values (Any Type) and returns an Appian Dictionary representation of those data. The list of keys and values MUST be of the same length or an error will be thrown. If no keys are provided an empty Dictionary will be returned. This provides a high-performance, low difficulty means of creating dynamic dictionaries (no more fromJson()) updateDictionary - Takes a CDT or Dictionary to update as well as a CDT or Dictionary containing the keys and values to insert/update and returns the updated result. If the input was a CDT the output will be cast to the same type for data cleanliness. This can be used to update specific keys of the dictionary, or to merge two disparate dictionaries into one. getKeysFromDictionary - Takes a CDT or Dictionary as input and returns a List of Text representing the included keys.

Release notes

***Version 2.0.1 -Removed unnecessary dependency. -Fixed DatatypeProperties import to use public API.

***Version 2.0.0 [NEW FUNCTIONS] updateDictionary, createDictionary, getKeysFromDictionary [DEPRECATED] joinCdt, updateCdt, expanCdt [MIGRATED] Three functions for manipulating data in Appian with more to come. These functions will allow the designer to use fewer script tasks and logic nodes by allowing for more in-expression manipulation of variables. Not only does this provide small boosts to performance, it also can greatly increase a model's readability. Deconstructing complex process-logic can be very time-consuming, despite designers' best efforts. This often results in wasted time while debugging and refactoring. SAIL logic, on the other hand, is much easier to annotate and decode. Hopefully, designers can use these functions to move some of the logic out of the process model and into expressions and outputs.

Example: =with( local!a: { {a:1,b:{1,2}} , {a:2,b:2} }, local!b: { {c:1,d:5} , {c:3,d:6} },

joincdts("INNER", local!a, {"a"}, local!b, {"d"}, "a", "c", "a", "b") --> {a.a: 1, b.d: 5}

expandcdt(local!a,"b") --> { {a:1, b:1} , {a:1, b:2} , {a:2, b:2} }

updatecdt(local!a, { a:{5,6} }) --> { {5, {1,2}} , {6, 2} } )

***Version 1.1.0 Fixes a bug where values could be shared across calls. joinCdt expandCdt updateCdt

Version history (3)

2.0.1

***Version 2.0.1 -Removed unnecessary dependency. -Fixed DatatypeProperties import to use public API.

***Version 2.0.0 [NEW FUNCTIONS] updateDictionary, createDictionary, getKeysFromDictionary [DEPRECATED] joinCdt, updateCdt, expanCdt [MIGRATED] Three functions for manipulating data in Appian with more to come. These functions will allow the designer to use fewer script tasks and logic nodes by allowing for more in-expression manipulation of variables. Not only does this provide small boosts to performance, it also can greatly increase a model's readability. Deconstructing complex process-logic can be very time-consuming, despite designers' best efforts. This often results in wasted time while debugging and refactoring. SAIL logic, on the other hand, is much easier to annotate and decode. Hopefully, designers can use these functions to move some of the logic out of the process model and into expressions and outputs.

Example: =with( local!a: { {a:1,b:{1,2}} , {a:2,b:2} }, local!b: { {c:1,d:5} , {c:3,d:6} },

joincdts("INNER", local!a, {"a"}, local!b, {"d"}, "a", "c", "a", "b") --> {a.a: 1, b.d: 5}

expandcdt(local!a,"b") --> { {a:1, b:1} , {a:1, b:2} , {a:2, b:2} }

updatecdt(local!a, { a:{5,6} }) --> { {5, {1,2}} , {6, 2} } )

***Version 1.1.0 Fixes a bug where values could be shared across calls. joinCdt expandCdt updateCdt

2.0.0

[NEW FUNCTIONS] updateDictionary, createDictionary, getKeysFromDictionary [DEPRECATED] joinCdt, updateCdt, expanCdt [MIGRATED] Three functions for manipulating data in Appian with more to come. These functions will allow the designer to use fewer script tasks and logic nodes by allowing for more in-expression manipulation of variables. Not only does this provide small boosts to performance, it also can greatly increase a model's readability. Deconstructing complex process-logic can be very time-consuming, despite designers' best efforts. This often results in wasted time while debugging and refactoring. SAIL logic, on the other hand, is much easier to annotate and decode. Hopefully, designers can use these functions to move some of the logic out of the process model and into expressions and outputs.

Example: =with( local!a: { {a:1,b:{1,2}} , {a:2,b:2} }, local!b: { {c:1,d:5} , {c:3,d:6} },

joincdts("INNER", local!a, {"a"}, local!b, {"d"}, "a", "c", "a", "b") --> {a.a: 1, b.d: 5}

expandcdt(local!a,"b") --> { {a:1, b:1} , {a:1, b:2} , {a:2, b:2} }

updatecdt(local!a, { a:{5,6} }) --> { {5, {1,2}} , {6, 2} } )

***Version 1.1.0 Fixes a bug where values could be shared across calls. joinCdt expandCdt updateCdt

1.2.0

[MIGRATED] Three functions for manipulating data in Appian with more to come. These functions will allow the designer to use fewer script tasks and logic nodes by allowing for more in-expression manipulation of variables. Not only does this provide small boosts to performance, it also can greatly increase a model's readability. Deconstructing complex process-logic can be very time-consuming, despite designers' best efforts. This often results in wasted time while debugging and refactoring. SAIL logic, on the other hand, is much easier to annotate and decode. Hopefully, designers can use these functions to move some of the logic out of the process model and into expressions and outputs.

Example: =with( local!a: { {a:1,b:{1,2}} , {a:2,b:2} }, local!b: { {c:1,d:5} , {c:3,d:6} },

joincdts("INNER", local!a, {"a"}, local!b, {"d"}, "a", "c", "a", "b") --> {a.a: 1, b.d: 5}

expandcdt(local!a,"b") --> { {a:1, b:1} , {a:1, b:2} , {a:2, b:2} }

updatecdt(local!a, { a:{5,6} }) --> { {5, {1,2}} , {6, 2} } )

***Version 1.1.0 Fixes a bug where values could be shared across calls. joinCdt expandCdt updateCdt