Skip to Content

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.

KVS.JPG

For example, a KVS with Employee ID’s and Names would look like:

EmployeeKeyValue.JPG

How do you use a PI Value Mapping to build this?


The corresponding VMG in PI can be built as follows:

EmployeeVMG.JPG

Understanding Rows:

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.

EmployeeVMG_Row1.JPG

Understanding Columns:

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.

EmployeeVMG_Columns.JPG

Other Considerations:

There are several considerations when trying to use VMG as a KVS.

For eg:

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.

3 Comments
You must be Logged on to comment or reply to a post.