July 11, 200718 yr I've not had any luck trying to figure this one out - my calculation skills are minimal! I have a Calculation (thanks Ted S /Genx) for a field called 'KN Prefix' which works just fine: Let ( [ dotCount = PatternCount ( VFX::KN Input Temp; "-" ); dotPos = Position ( VFX::KN Input Temp; "-"; 1 ; dotCount ) ]; Left ( VFX::KN Input Temp; dotPos - 1 ) ) However if a field called 'Slate' in the same table is empty, I want this calculation to either stop or if a value has already been entered in 'KN Prefix' I need it to be cleared. In simple (non FM) terms its needs to do this before the calc: if Slate is empty then clear KN Prefix and stop otherwise continue Apologies for the crude description, Thanks, Mark
July 11, 200718 yr One field cannot clear another field, unless the process is automated with scripts and/or event plugins, which are generally not necessary. You explanation isn't really clear. I'd have a field called "KN Prefix Entry" which is a text field, and a field called "Slate" whch is also a text field. Create a calc field called "K Prefix" which would be: If( IsEmpty( Slate ) ; "" ; KN Prefix Entry ) If Slate is empty then display nothing, otherwise display the contents of KN Prefix Entry.
July 11, 200718 yr Author Thanks Vaughan. That seems to work well. One last question though: Is it possible to have a Lookup request as part of that if statement? So instead of saying use 'KN Prefix Entry' if 'Slate' is not empty, it would be something like, do Lookup if 'Slate' is not empty? Thanks, Mark
July 12, 200718 yr Why do you want to use a Lookup? Lookups are *only* useful if there is a need to bring in a related value at the time of record creation and keep it static for historical purposes (like a price, or a tax rate). If you want to bring in a *related* value, then just specify it in the calculation. A looked-up value would be done by adding another text/number field as a lookup, then including this in the calc. The field would have the value in it even if it isn't needed.
July 12, 200718 yr Author Good point! I am still finding my feet in this area and hadn't fully understood when to use Lookup and when to use Calculation. You're absolutely right though, a calc is much more suitable. This is all working great now, thanks for your time and help.
Create an account or sign in to comment