# enable or disable a field based on the presence of domain values of a selected column?

**URL:** <https://forum.knime.com/t/enable-or-disable-a-field-based-on-the-presence-of-domain-values-of-a-selected-column/90319>\
**Category:** Node Development\
**Created:** [October 28, 2025, 9:55am UTC](https://forum.knime.com/t/enable-or-disable-a-field-based-on-the-presence-of-domain-values-of-a-selected-column/90319 "2025-10-28T09:55:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![niederle](https://forum-cdn.knime.com/user_avatar/forum.knime.com/niederle/32/42_2.png) [@niederle](https://forum.knime.com/u/niederle)\
**Post date:** [October 28, 2025, 9:55am UTC](https://forum.knime.com/t/enable-or-disable-a-field-based-on-the-presence-of-domain-values-of-a-selected-column/90319/1 "2025-10-28T09:55:27Z")

</div>

Sorry for all these very specific questions but I try to implement a node where the user can select a single column. If this column does have domain values a checkbox should be enabled (not set). Is that possible? I did not succeed whatever I tried.

This is what I tried so far:

```java
    @Widget(title = "Select Column", description = "...")
	@ValueReference(value = ColumnNameRef.class)
	@ChoicesProvider(DoubleStringColumnsProvider.class)
	String m_inputColumn;
	
	interface ColumnNameRef extends ParameterReference<String> {
    }

	@Widget(title = "checkbox", description = "...")
	@Effect(predicate = HasDomainValues.class, type = EffectType.ENABLE)
	boolean m_option = false;
	
	static final class HasDomainValues implements EffectPredicateProvider {

		@Override
		public EffectPredicate init(PredicateInitializer i) {
			return i.getConstant(
	                (NodeParametersInput context) -> {
	                	String selectedColumn = i.getString(ColumnNameRef.class).toString(); //cannot get the name of the selected column this way!
	                	DataColumnDomain domain = context.getInTableSpec(0).map(tSpec -> tSpec.getColumnSpec(selectedColumn).getDomain()).get();
	                	return domain.hasValues() || domain.hasBounds();
	                });
		}
		
	}

```

Thanks a lot in advance!

---

<div class="post-metadata">

**Author:** ![robin\_gerling](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/r/f05b48/32.png) [@robin\_gerling](https://forum.knime.com/u/robin_gerling)\
**Post date:** [November 3, 2025, 8:47am UTC](https://forum.knime.com/t/enable-or-disable-a-field-based-on-the-presence-of-domain-values-of-a-selected-column/90319/2 "2025-11-03T08:47:03Z")

</div>

Hi @niederle,

Currently, this is not possible directly, but it can be done with some effort.  
You need to add another boolean field such as `m_inputColumnHasADomain` as intermediate state.

```java
@ValueProvider(InputColumnHasADomainValueProvider.class)
@ValueReference(InputColumnHasADomainValueReference.class)
@Persistor(InputColumnHasADomainPersistor.class)
boolean m_inputColumnHasADomain;

```

- Without the `@Widget` annotation, the field will not be displayed in the dialog.
- The `ValueProvider`should update the boolean field when the dialog gets opened/the input column changes to calculate whether the current input column has a domain.
- The `ValueReference`can then be used in the `EffectPredicateProvider`: (`i.getBoolean(InputColumnHasADomainValueReference.class).isTrue()`)
- The `Persistor` should be used to not save the field as a setting, as it is only used for effects in the dialog. (`load() { return false}`, `save() {}`, `getConfigPaths() {return new String[0][]}`

Best,  
Robin

---

<div class="post-metadata">

**Author:** ![niederle](https://forum-cdn.knime.com/user_avatar/forum.knime.com/niederle/32/42_2.png) [@niederle](https://forum.knime.com/u/niederle)\
**Post date:** [November 24, 2025, 12:23pm UTC](https://forum.knime.com/t/enable-or-disable-a-field-based-on-the-presence-of-domain-values-of-a-selected-column/90319/3 "2025-11-24T12:23:45Z")

</div>

@robin_gerling  
Thanks a lot! Your proposed solution works perfectly! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [December 1, 2025, 12:23pm UTC](https://forum.knime.com/t/enable-or-disable-a-field-based-on-the-presence-of-domain-values-of-a-selected-column/90319/4 "2025-12-01T12:23:57Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
