Emptyfill with a formula isnt working as expected


#1

emptyfill with a formula isnt working as expected.
the formula is evaluated for the current (ie, highlighted) record, then that value is is used to fill every empty cell in the designated field.

this is the code:
    field modelyear
    emptyfill str(val(added) - 1)
modelyear and added are both text fields where the values represent years.
if the value for added in the current record is ‘2012’, all empty cells in the modelyear field are filled with ‘2011’.
if the value for added in the current record is ‘2011’, all empty cells in the modelyear field are filled with ‘2010’.

the problem is definitely with emptyfill, not with str( or val(, as formulafill with the same formula works as expected.


#2

This is exactly what emptyfill is supposed to do. It’s not a formulafill that only fills empty cells. It’s a fill that only fills empty cells. The formula is evaluated once, in the context of the current record, and the result goes into every visible, empty cell in the field.


#3

The Pan X Help says:

The fill statement fills every cell with a specified value. If you want cells in different records to have different values, use the formulafill statement, like this:

formulafill ?(sizeof(info(“fieldname”))>0,«»,SOME FORMULA HERE)


#4

my mistake.
i thought emptyfill worked like foumulafill, not like fill.