Here's another example of a Content Based Routing or Dynamic Process Flow.
We can have a FTP Source (with eventContextEnabled) that receives data file and the actual file location from the FTP Trigger. Based on the FilePath (i.e., where the file is dropped) we do a lookup into a reference table and determine the related Source Schema, Mapping and the Target activities. The Lookup provides us with the Entity ID information which we then dynamically assign to the placeholder 'dummy activities' in the flow.
One of the key object in this flow is the custom plugin that has the code to grab the incoming file path and then use this path to do a lookup into a reference table. This code is also attached along with the process flow XML.
The variable 'TypedId' expects value in certain format which is 'ActivityType:ActivityId' where ActivityType is the type of activity which needs to be dynamically overridden and ActivityId is the id of activity with which you want to override your existing activity. The variable name is 'TypedId' which is a combination of Type and Id and it expects value in that format. For example DataMapping:172016065135124110720431200023
Here's another example of how database lookups are used in content based routing process flows: