- Would you like to create a new table based on unique values from a different table?
- Would you like to learn how to reference a column in a TERR data function?
- Are you combining data from different sources and having problems with duplication?
I am currently working on a project that joins oil and gas header data from three different data sources (via an insert rows operation). Then, that data gets put onto a map. The user marks the map, which then executes an on-demand query to pull in the production data for only marked wells. With this architecture, the file opens quickly and only brings in production data for the wells needed. However, it has a flaw. Wells can be on the map three times (and in the on-demand query three times). That’s inefficient. Instead, I worked up a solution to find unique values with TERR.
I can still use my existing architecture and improve the project by using a TERR data function to create a list of unique APIs from the master header table. Then, I can populate the map from this new, smaller table. Users will still mark the map, but when they do a more efficient query is generated.
All it takes is a simple line of code using the unique function. Now, if you’ve never created a TERR data function before, I suggest this read on TERR basics. I’m not going to show every TERR screen, but if you understand the basics explained in that post, you’ll be fine. Here is what the code looks like.
uniqueAPI10 <- unique(c(masterheader$API10))
After clicking Run, Spotfire will ask you to map the parameters to the data. I mapped the masterheader object to my master header table, only bringing in the API10 column because that’s all I needed. Then, I told it to create a new table called uniqueAPI10. Now, I have a new table with only the unique API10 values.
This is a simple example, but it shows you how to find unique values with TERR.
Content created with Spotfire 7.12.