Skip to main content

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?

 

 

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.
 

 


The workbench does what you have defined.

I think,

else   featurer-1].test

delivers the desired result.


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

 


Hi ​@norris ,

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

 


Thank you so much ​@takashi This worked perfectly!