Skip to main content
Question

Lookup table to find nearest smallest value

  • June 5, 2020
  • 4 replies
  • 21 views

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

takashi
Celebrity
  • 7843 replies
  • June 5, 2020

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


takashi
Celebrity
  • 7843 replies
  • June 5, 2020

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+44
  • Influencer
  • 3427 replies
  • June 5, 2020

The Inline Querier is another option

select t1.Name, t1.Value, max(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


  • Author
  • 2 replies
  • June 8, 2020

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