Value Mapping: Using Value Mapping Group as a Key Value Store – Part 2
Part 1: Describes a framework to leverage VMG as a Key Value Store(KVS).
Part 2: In this post, I talk about leveraging this KVS in a mapping.
Review Key Value Store:
Row 1: Header Row is set of three constants. Think of it as the header row.
Rows 2..n: contain the Key Value pairs in columns 2,3(Scheme/Value). Column 1(Agency) is a repeating constant.
How do I lookup data from a Value Map?
To look up data from a value mapping the “Key” is a combination of 5 fields. This key looks up the “Value”.
Key(5 fields): Sender Agency + Sender Scheme + Sender Value + Receiver Agency + Receiver Scheme
Value(1 field): Receiver Value
This is true for Value mapping in general, not just our Key Value Store.
How do I lookup data from our Key Value Store?
Since our store is actually a Value Map. The same rules apply. We use a key made from 5 fields to look up a value.
Field 1/2/3/4 are constants.
Field 5 = Actual Key
Field 6 = Value
Can I lookup values using standard function in a map?
Yes and No.
While you can use the standard function to perform a lookup, its is not very useful.
This is because the dynamic part of our “Key”(field 5) becomes static.
How do I lookup values using a custom UDF in a map?
There are several ways to build such a UDF.
You could have a one field UDF, if you hard code the constants in the UDF.
Or you can use a 5 input UDF that allows you to pass all the constants.
This has the benefit of being generic and can be reused.
Part 1 is a framework to organize and manually maintain key value pairs in the integration directory using Value Mapping Groups.
Part 2 describes three different ways to lookup this information in mappings via standard and custom functions.
This framework can replace simple property files that are often maintained on the file system.
In the next part, I hope to cover ways to programmatically maintain key value stores using Mass Value Mapping Replication.