Fill Down
Forums
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.
Those do exactly what I
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
try:
with open (last_value_file, 'r') as file:
last_value = file.readline().strip()
except FileNotFoundError:
pass
if arg:
last_value = arg
with open (last_value_file, 'w', newline = '', encoding='utf-8') as file:
file.write(last_value)
return last_value if not arg else arg
Hi Teej, it already exists in
Hi Teej, it already exists in IDEAScript, https://ideascripting.com/ideascript/fill-down-utility and it is also part of the SmartAnalyzer Utility app that can be found in passport. Are you looking for something different to this?