Skip to main content

Fill Down

New to python and new to IDEA(ver 11.2).
Is it possible to create an @python function to fill down a field with the last non-blank value?
I've tried, but can't figure it out. I can do this from python using the IDEALib module, but would like to use a custom function if possible.
Any guidance appreciated.

Teej Tue, 04/23/2024 - 22:57

In reply to by Brian Element

Those do exactly what I wanted, and work great. They fulfill the goal I was trying to accomplish, just a bit different execution than I was originally  looking for.
I have managed to create an @python function that seems to be able to do the same thing, but don't feel confident it's a good or correct implementation. Any feedback, additional info, warnings, etc. are welcomed.      
def ffill_down(arg):
    last_value_file = (r’file\location\here.txt')
    last_value = None
        with open (last_value_file, 'r') as file:
            last_value = file.readline().strip()
    except FileNotFoundError:
     if arg:
         last_value = arg
             with open (last_value_file, 'w', newline = '', encoding='utf-8') as file:
    return last_value if not arg else arg