I would not use any global variable at all. The TField has access to the DataSet that owns the current record's fields, eg:
Text := Format('%.*f', [Sender.DatSet.FieldByName('decimals').AsInteger, Extended(Sender.Value)]);
Alternatively:
Text := FloatToStrF(Sender.Value, ffFixed, 18, Sender.DatSet.FieldByName('decimals').AsInteger);