Proper data validation using inRiver

André Reis
Beerwulf
Published in
4 min readFeb 7, 2019

As a Web Shop and its product catalog grows and the complexity increases, it is crucial having a system that is responsible for holding product information and sharing that information across other systems. These are known as PIM (Product Information Management systems).

One of the most important features of such systems is the level of data validation available, in order to minimise the capturing of “bad” data.

In this post I’ll show how to perform data validation using inRiver iPMC, taking into account UX, and providing pros and cons for each method.

Use Case

Create a field which only accepts numbers from 0 to 5, and prevent the user to Save invalid data.

Method #1 : Regular Expression (RegExp)

Create a new String field in Control Center > Model > YourEntity. While creating the field, expand the Settings panel and add a new entry:

Key: RegExp

Value: [0–5]

Control Center > Model > YourEntity > YourField

Tip: Use the Description panel to inform the user about the format restriction. This text is shown when the user overs the field name.

If the user tries to Save an invalid value the following error is displayed:

ENRICH’s User Experience using RegExp

Pros:

  • Covers all possible use cases.

Cons:

  • User Experience: The user has the ability to write any alphanumeric string, and feedback is only given after pressing Save. 😵
  • Creating the actual RegExp, specially for more complex use cases, can be tricky — It requires some experience to master regular expressions.
  • Error message (“Value not in correct format”) could be more intuitive, e.g. by including a custom message.

Method #2 : CVL

The most efficient way to create a certain sequence in a CVL is to use an Excel/Sheets file.

You need the following columns: Key; SortOrder; Value

Key and SortOrdersequence from 1 to N (number of different values).

Value — values you want. In our case: numbers from 0 to 5.

In Control Center > Model > CVL > Add CVL of Data Type String, give it an Id (name), leave everything else with the default values and Save.

Now find the CVL in the list and click on it, then Import CVL Values using the file we just created. This is how it looks like after the import:

Control Center > Model > CVL > Range0to5

Then, create a new CVL field in Control Center > Model > YourEntity, and select your CVL from the list.

By providing a list of options, there is no space for user errors using this method. The user sees the following:

ENRICH’s User Experience using CVL

Pros:

  • User experience: selecting a value from a list.
  • User can use the search to filter results, specially if the list is big. 👍

Cons:

  • You can end up in a sea of CVLs, if different ranges are needed for other fields.

Method #3 : Server Extension

Probably the most overkill solution (at least for our use case) is to use the OnUpdate method from the IServerExtension.

Basically this allows to intercept the Update action (i.e. Save button click) and add some logic to decide if that action should be executed or cancelled. In the case of cancellation you can also provide a Message with an explanation.

Bellow you can find the code of the Server Extension.

Build the project, zip the content of the bin > Debug/Release folder. Afterwards, in inRiver’s Control Center, upload the zip to Connect > Packages, and Add the ServerExtension to Connect > Extensions.

Important: Assembly Type follows the pattern: <Namespace>.<ClassName>

If the user tries to Save an invalid value the following error is displayed:

ENRICH’s User Experience using Server Extension

Pros:

  • Covers all possible use cases.
  • One can even add more business logic, couple with other fields, entities, etc.. (the sky is the limit! 🌟 )

Cons:

  • User Experience: The user has the ability to write any alphanumeric string, and feedback is only given after pressing Save. In our case we can benefit from a built in data type validation, since field data type is Integer, characters will not be allowed to be Saved.
  • Requires development and (re-)import of the Extension. 😭

Cheat sheet

  • Stick with CVLs for well defined domains (e.g. country list) or small/medium sets (e.g. grades from 0 to 20).
  • Use Regular Expressions for simple validations, and only if you are familiar using them or kin to spend some time learning them.
  • Otherwise use Server Extensions, which allows you to perform both simple or super complex validations.

Conclusion

Although there are several ways to perform validations in inRiver, I would expect some built in data validation for the basic data types (String, Integer, Double and DateTime), at least as good as Data conditions in ENRICH’s Queries:

ENRICH’s Queries — Data conditions for String (left) and Integer/Double/DateTime (right)

Some could argue that this basic validation could be done using Queries (assigned to nodes in Plan&Release) or even custom Completeness Rules, but those do not allow instant and explicit feedback (bad UX), and require more configuration/development.

Thanks to Siegfried Grimbeek

--

--