Skip to main content
Question

Lookup table to find nearest smallest value


Hello!

I have two tables:

Table 1:

NameBasevalueaaa0bbb0bbb5bbb11ccc0

 

Table 2:

NameValuebbb3bbb8bbb10ccc8

 

Now I want to get for each feature from table 2 the nearest smaller 'Basevalue' from table 1 compared to the 'Value' of table 2.

The Result should look like this:

NameValueResultValuebbb30bbb85bbb105ccc80

 

Any ideas how to do so?

Greetings

Stefan

4 replies

takashi
Influencer
  • June 5, 2020

Hi @ferorelatum, this screenshot illustrates a possible way to do that.


takashi
Influencer
  • June 5, 2020
takashi wrote:

Hi @ferorelatum, this screenshot illustrates a possible way to do that.

Another thought. The ListElementFilter is a custom transformer from the FME Hub.

 


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • June 5, 2020

The Inline Querier is another option

select t1.Name, t1.Valuemax(t1.Basevalue) as ResultValue from (select * 
    from "Sheet2" s2,
    "Sheet1" s1
    where s2."Value" >= s1."Basevalue" 
    and s2.Name = s1.Name) t1
    group by t1.Name, t1.Value

find_nearest_below.fmwt


@takashi @ebygomm thanks a lot! Both of your options works fine!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings