To be honest, it is unlikely that we can add that functionality natively to the DataMapper.
You have to remember that each DataMapper configuration can only handle a single type of data source (CSV, XML, PDF, etc.). So if you were to send multiple files of multiple formats, the DM wouldn’t know how to handle them because each data type is handled by a distinct internal module.
Assuming we implement a restriction such that all files must be of the same type (let’s say XLS). Then we’d have to be able to tell which Tab of which XLS to use when extracting, looping or creating conditions in the DM config. And we’d have to set up each additional file so that we’d know the boundaries for each record in that file.
So for instance, the JavaScript code for extracting a single field (currently something like data.extract('FirstName',0);
) would have to be modified to something like data.extract('FirstName',0,'MyOtherFile','MyFirstTab')
, but that still wouldn’t work either because the 0 represents the offset from the current position in the current record… but what is the current position in that other file? And what is the current record?
Now imagine having to implement the same type of lookup for all data formats, including Text files and PDFs!
I think a more realistic approach would be for us to implement a native method for looking up values in certain specific types of external data sources. So for instance, we could lookup inside an Excel file using something like
data.lookup("MyOtherFile.xsl","Tab1.column['FirstName']","John", "Tab1.column['LastName'])
which would search for the first John in column FirstName
and retrieve the value of the LastName
column on the same row. (By the way, that is essentially what the Workflow plugin does).
However, we’d have to craft it in such a way that performing the lookup doesn’t slow down the DM Engine to a crawl: we wouldn’t want the lookup to have to open, fetch and then close the external file on each call of the lookup function!.
So hopefully, this explains why the feature - although it may seem like an obvious shoo-in for adding to the DM - is extremely complex to analyze and implement in a way that would actually be useful.
That said, I find this discussion very interesting, because it is prompted by actual use cases where you guys have to resolve actual problems day in and day out with our software. So let me ask you something in return, then: in what kind of data file do you most often find yourself looking for additional values? Would it be external CSV files? Or XML? Something else?
If, for instance, we find that most users are just looking for a quick way to lookup values in an XML file or in an Access database, then we could implement something specifically for that data format.