Nesting Dictionaries

Am I able to get something that would look like nested Dictionaries?

Here is my aim. I work on projects, which always have the same set of variables, so:

%AssignmentCode% = ACMECP001
%Assignment% = ACME Consulting Project
%ClientName% = ACME Industries
%ContactPerson% = Jean Smith
%TransactionCode% = 40404
%CloseDate% = 1 April 2018
(There are almost 30 variables per project I would like to store)

At the same time am I working on other Assignments; some for the same client e.g ACME Review Project, and some for other clients, each of which has a unique Assignment Code.

I would like to be able to name the Dictionary dynamically as part of the macro, ideally with the unique Assignment Code, then have the other variable names as each Key, with their corresponding values.

Dictionary: %AssignmentCode%
Key: %Assignment%
Value: ACME Consulting Project

Dictionary: %AssignmentCode%
Key: %ContactPerson%
Value: Jean Smith

That way KM would be storing my ContactPerson for one assignment in its own Dictionary at the same time as it is storing my ContactPerson for another assignment in its corresponding Dictionary.

I don't think you can actually nest dictionaries, but you can dynamically name them, like this:


Does that do what you want?

For more powerful, complex handling of dictionaries (objects), you can use JavaScript (JXA).

1 Like

That is exactly what I had originally wanted to do, and failed. I think I now see why; I don’t have the habit of using the ‘full’ variable name in the form %Variable%AssignmentCode%.

I had tried to name the Dictionary simply as %AssignmentCode%, which presumably didn’t work because we’re dealing with a token.


1 Like