If then condition and autogenerate specific value