# Redefine or delete input values?

**URL:** <https://community.smartthings.com/t/redefine-or-delete-input-values/172287>\
**Category:** Writing SmartApps\
**Created:** [September 5, 2019, 6:56pm UTC](https://community.smartthings.com/t/redefine-or-delete-input-values/172287 "2019-09-05T18:56:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrbarron](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@jrbarron](https://community.smartthings.com/u/jrbarron)\
**Post date:** [September 5, 2019, 6:56pm UTC](https://community.smartthings.com/t/redefine-or-delete-input-values/172287/1 "2019-09-05T18:56:17Z")

</div>

I am writing a simple SmartApp with some dynamic preferences. I have some inputs for devices and user-defined numbers. I can’t seem to find out how to “remove” these devices and numbers if they are no longer relevant. I’d like to redefine them to be null, if possible.

Abbreviated version of my preferences are below to illustrate what I’m trying to do:

```
section("Select Mode for Heating, Cooling, or Both..."){
		input("mode", "enum", title: "Heat or Cool?", options: ["Heat","Cool","Both"], required: true, submitOnChange: true)
	}        
    if (mode == "Heat" || mode == "Both") {
    	section("Details for Heating... ") {
    		input("heatSwitch", "capability.switch", title: "Heater", required: true, multiple: false)
            input("heatTemp", "decimal", title: "Set min temp for heater", description: "min temp", required: true)
        }
	}
    if (mode == "Cool" || mode == "Both") {
		section("Details for Cooling... ") {
        	input("coolSwitch", "capability.switch", title: "Cooling Device", required: true, multiple: false)
            input("coolTemp", "decimal", title: "Set max temp for cooler", description: "max temp", required: true)
		}
    }

```

Basically, if the user selects mode = “Both” for heating and cooling, they have to define all 4 variables. If they later change to just cooling, the device and temperature for the heating application remain unchanged. It would make it much easier if I could redefine those both to null either inside the preferences, or in my update/initialize method.

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![philh30](https://avatars.discourse-cdn.com/v4/letter/p/41988e/32.png) [@philh30](https://community.smartthings.com/u/philh30)\
**Post date:** [September 5, 2019, 7:11pm UTC](https://community.smartthings.com/t/redefine-or-delete-input-values/172287/2 "2019-09-05T19:11:06Z")

</div>

> [@Update preferences field from code](https://community.smartthings.com/t/update-preferences-field-from-code/21219/5):
>
> It appears you can now use: app.updateSetting(inputName, [type: type, value: value]) app.updateSetting(inputName, value) // or for DTHs: device.updateSetting(inputName, [type: type, value: value]) device.updateSetting(inputName, value) However, while the above code seems to be able to change settings with existing non-null values, it does not appear to be able to add values to settings that are currently empty. So half-way there at least…
