addtruncatefunction