Appending Column conditional to Values in a Second Table

I’m struggling to do something like a conditional append using two separate tables. The first contains point values and the second contains intervals. I’d like to append a column to the first table with a value that corresponds to a value in the second table for a specific interval, plus an additional condition that another column must match between both tables.

For example:
Table 1:
image

Table 2:
image

Where NewCol in Table 1 would be the ‘Lith_Code’ (from Table2) when HoleID = HOLEID AND ‘Depth’ is between ‘From’ and ‘To’ in Table 2.

Basically this is about attributing interval data to point data within those intervals.

PS this is a poor example since none of those points fall within those intervals but hopefully the intention is clear.

Hi @Goldeneye83 -

One way you could do this is by using the Rule Engine (Dictionary) node, with your Table 1 input to the top port, and your Table 2 transformed into rules and input to the bottom port. Here are a couple of threads with example usage of that node:

Hope this helps you get started, but feel free to ask questions here if you get stuck.

5 Likes

Hi @ScottF and thanks. I actually just ended up extracting all the possible depths using an occurrence table from the Statistics node, cross-joined that with the interval table, and then filtered out all the extra rows where depths were above or below the limits of the interval, using the Rule-based row filter, and then did a Left Outer join to bring that table back to the original point data with the classification now included. Probably a bit computationally expensive but I was struggling with the Rule Engine.

image

1 Like

Glad you found a solution that works for you! :+1:

1 Like

Hi there @Goldeneye83,

if I got you right you should be able to do this with only two nodes. First do join (Left outer) using Joiner node on HoleID columns which will add FROM and TO columns into first table and after that use Rule-based Row Filter as you already did in your workflow. Or I’m missing something?

Br,
Ivan

1 Like

Yep I think you’re absolutely correct @ipazin. That should work perfectly with way less clutter. Thanks!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.