1

Can you help me to compare fields in two tables? I have two tables, which contain ID and Measure fields. I need to take stroke by stroke values from field1(table1) and find all values in field1(table2) which are less than sought-for value. And then take largest of them and put it on stroke field2(table1). Example showed on picture below.enter image description here

  • you seem to round down 25 to 20 and 35 to 30 is that correct? – Mapperz Mar 31 '15 at 16:37
  • No, i need to find nearest value from another table – s1epPy Mar 31 '15 at 16:56
  • It's basically nothing to do with the ID field. It all comes down to Field1 and Field2. – Mark Ireland Apr 1 '15 at 14:03
1

OK, so you basically need to compare each of the records in table 2 against each record in table 1. To me that suggests you are going to need a loop of some sort. You could either use a loop (or nested loops) inside a Custom Transformer, or you could do an alternative type of loop using a list.

For the Custom Transformer, check out this FMEpedia example, or read chapter three of the FME Desktop Advanced training course.

For the list-type looping, check out my blog post on the subject.

Hope this helps. It's a tricky problem, but one that should be solvable with a little work.

0

I am a bit confused by your image. It looks like you're trying to join two tables. But your resulting table appears to have incorrect values in Field 2.

I'm going to assume you're trying to join the two tables based on the ID field.

This is a fairly straightforward process in FME. You can use the FeatureMerger Transformer.

Connect Table 1 to the Requestor port and Table 2 to the Supplier port. In the FeatureMerger dialog, you'll select the attributes that you'll be joining on. In your case, this will be ID.

enter image description here

As long as there is no geometry and it's just tables, your Merge Type will be Attributes Only.

If you are then trying to find the smallest of the two fields, you will use an Attribute Creator Transformer and set the value using the Conditional option. I've called my attribute "Smallest" in this example.

enter image description here

enter image description here

And your condition would look something like this:

enter image description here

  • It seems to me he needs to find the closest value in table 2 to the value in table 1, that is also less than the table 1 value. Sort of like "The Price is Right"! Table 1 would be the list of prices, table 2 would be the contestant guesses. The contestant needs to be as close to the price as possible without going over. I'll have a think about it. – Mark Ireland Apr 1 '15 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.