Skip to main content
Solved

Fill in adjacent empty values in table is not working as I expect?


norris
Contributor
Forum|alt.badge.img+3

I am trying to fill in the rows of my table with the previous values. I saw this thread and I am following the instructions but for some reason I am only getting the first empty row to be filled but not any subsequent rows. 

 

I tried to change the Subsequent Features to another value other than 0 and even tried to change the number of Prior Features but I always get the same results.

I am on FME Form 2024.2.0.0 if that helps. 

Any suggestions as to what I am doing wrong?

 

 

Best answer by takashi

Hi ​@norris ,

If I understand your requirement correctly, I think this setting  works as expected.

 

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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.

5 replies

crutledge
Influencer
Forum|alt.badge.img+32
  • Influencer
  • May 9, 2025

Hi ​@norris From what I see, if you are trying to fill the <nulls> in the “test” column you could replace .fastigeter with .test
The way I read the example you have the red lines are what is being written from Fastigheter to test


Hope that helps.
 

 


tomfriedl
Contributor
Forum|alt.badge.img+13
  • Contributor
  • May 9, 2025

The workbench does what you have defined.

I think,

else   feature[-1].test

delivers the desired result.


norris
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • May 9, 2025

Hi,

Thanks for the suggestions ​@crutledge and ​@tomfriedl 

Apologies for not being clear in my original post. The screenshot to the right (in my original post) is what i get as a result from the AttributeCreator as I created a new column called “test” in the AttributeCreator. The “input” is the column “Fastigheter” and what i want is the column “test” to contain the filled row values.

Here is what the input table looks like (just dummy to test things)

here is what I wanted to do with AttributeCreator (but did with Python)

I did manage to get my desired result with pythoncaller but it would be nice to know how to get it to work using a transformer.

here is my python caller code if anyone was interested


 

class FeatureProcessor(object):
    def __init__(self):
        # Store the previous non-empty value
        self.previous_value = None

    def input(self, feature):
        # Get the current value of the 'Fastigheter' attribute
        current_value = feature.getAttribute('Fastigheter')

        # Check if the value is empty or None
        if current_value is None or current_value == '':
            # If empty, use the previous non-empty value (if available)
            if self.previous_value is not None:
                feature.setAttribute('Fastigheter', self.previous_value)
        else:
            # If not empty, update previous_value
            self.previous_value = current_value

        # Output the feature
        self.pyoutput(feature)

    def close(self):
        pass

 


takashi
Influencer
  • Best Answer
  • May 9, 2025

Hi ​@norris ,

If I understand your requirement correctly, I think this setting  works as expected.

 


norris
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • May 9, 2025

Thank you so much ​@takashi This worked perfectly!


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