This is the formula you want
not Position ( GetAsText ( containerfield ) ; get(RecordNumber) ; 1 ; 1 )
I don't think you mean Record Number. Record Number is something that changes with every found set. If you sort, Record Numbers change.
Hopefully you have an ID field of some sort. You need something static.
Get ( RecordID )
will return the unique FM record ID that cannot change.
Personally, I prefer a Primary key, so I'm hoping there is one. Record ID can have troubles if there is ever a need to re-import records or some such thing. The primary keys could be Imported as is.
But RecordNumber will cause all sorts of problems.
Let's say you switch to naming with the primary key. Then for conditional formatting, you could use all sorts of formulas to conditionally highlight as desired.
Patterncount ( list ( relatedtable::filename ) ; pk_ID ) = 0
would impose your formatting anytime the PK wasn't somewhere in the name of any file related to the pk record.
I'll bet someone has a better way than my example, too.
Don't you want to forbid inserting 124a.jpg ?
actually yeah good point. Forbidding the file would be even better
Not true. RecordID can and does change when you clone the file, or if you import records between copies of the same database.
"Validate by calculation" on the container field like as
PatternCount ( GetContainerAttribute ( Self ; "filename" ) ; Get ( RecordNumber ) ) = 1
then invalid file can't be saved.
Now better way for "Get(RecordNumber)" part is discussed by others.