Value Mapping: Using Value Mapping Group as a Key Value Store – Part 1
Why do we need this post?
Value Mapping Groups(VMG) in PI are not designed to be used as Key Value Stores(KVS).
Trying to build a KVS using value mapping is confusing and counter intuitive. Every time I have to do this, I spend an hour trying to re-learn everything.
I hope this blog post saves me and everyone else some time.
What does a Key Value Store look like?
A combination of keys and values. You can use a key to lookup the corresponding value.
For example, a KVS with Employee ID’s and Names would look like:
How do you use a PI Value Mapping to build this?
The corresponding VMG in PI can be built as follows:
Row #1(Const,Const,Const): The “Header Row” is a series of constants. You can save anything here. I recommend you store the column names in this row. For eg: EmpID and EmpName
Row #2..n(Const,Key,Value): The remaining rows will contain the key value pairs.
Column #1(Const): The first column should contain any constant value. I recommend you store KeyColumnName + ValueColumnName(EmpID_EmpName)
Column #2(Keys): The second column contains the keys.
Column #3(Values): The third column contains the values.
There are several considerations when trying to use VMG as a KVS.
The standard UDF cannot look up Key Values.
Values have length limitations.
Group ID vs Group Name
Mass Value Replication
I hope to cover some of these in my next post.