diff --git a/app/src/main/java/org/dhis2/usescases/development/DevelopmentActivity.java b/app/src/main/java/org/dhis2/usescases/development/DevelopmentActivity.java
index 5bcf549f3a9..3c8add8f6e0 100644
--- a/app/src/main/java/org/dhis2/usescases/development/DevelopmentActivity.java
+++ b/app/src/main/java/org/dhis2/usescases/development/DevelopmentActivity.java
@@ -14,6 +14,7 @@
import org.dhis2.usescases.general.ActivityGlobalAbstract;
import org.hisp.dhis.android.core.D2;
import org.hisp.dhis.android.core.D2Manager;
+import org.hisp.dhis.android.core.common.ValueType;
import java.io.BufferedReader;
import java.io.IOException;
@@ -39,6 +40,24 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
loadCrashControl();
loadFeatureConfig();
loadConflicts();
+ loadMultiText();
+ }
+
+ private void loadMultiText() {
+ D2 d2 = D2Manager.getD2();
+ boolean hasMultiText = !d2.dataElementModule().dataElements().byValueType().eq(ValueType.MULTI_TEXT).blockingIsEmpty();
+ binding.multitext.setText(hasMultiText ? "REVERT" : "FORCE MULTITEXT");
+ binding.multitext.setOnClickListener(view -> {
+ if (hasMultiText) {
+ d2.databaseAdapter().execSQL(
+ "UPDATE DataElement SET valueType = \"TEXT\" WHERE valueType = \"MULTI_TEXT\" AND optionSet IS NOT null"
+ );
+ } else {
+ d2.databaseAdapter().execSQL(
+ "UPDATE DataElement SET valueType = \"MULTI_TEXT\" WHERE valueType = \"TEXT\" AND optionSet IS NOT null"
+ );
+ }
+ });
}
private void loadConflicts() {
diff --git a/app/src/main/res/layout/development_activity.xml b/app/src/main/res/layout/development_activity.xml
index a7a57ce5cc7..212ff2bad1d 100644
--- a/app/src/main/res/layout/development_activity.xml
+++ b/app/src/main/res/layout/development_activity.xml
@@ -185,6 +185,32 @@
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="UI Components" />
+
+
+
+
+
+
+
diff --git a/commons/src/main/java/org/dhis2/commons/bindings/ValueExtensions.kt b/commons/src/main/java/org/dhis2/commons/bindings/ValueExtensions.kt
index fff9e1d2354..85c0602f01b 100644
--- a/commons/src/main/java/org/dhis2/commons/bindings/ValueExtensions.kt
+++ b/commons/src/main/java/org/dhis2/commons/bindings/ValueExtensions.kt
@@ -191,7 +191,7 @@ fun TrackedEntityDataValueObjectRepository.blockingGetValueCheck(
private fun check(d2: D2, valueType: ValueType?, optionSetUid: String?, value: String): Boolean {
return when {
- valueType!= ValueType.MULTI_TEXT && optionSetUid != null -> {
+ valueType != ValueType.MULTI_TEXT && optionSetUid != null -> {
val optionByCodeExist = d2.optionModule().options().byOptionSetUid().eq(optionSetUid)
.byCode().eq(value).one().blockingExists()
val optionByNameExist = d2.optionModule().options().byOptionSetUid().eq(optionSetUid)
diff --git a/form/src/main/java/org/dhis2/form/ui/FieldViewModelFactoryImpl.kt b/form/src/main/java/org/dhis2/form/ui/FieldViewModelFactoryImpl.kt
index 2ebd582d3de..9ac45c6545f 100644
--- a/form/src/main/java/org/dhis2/form/ui/FieldViewModelFactoryImpl.kt
+++ b/form/src/main/java/org/dhis2/form/ui/FieldViewModelFactoryImpl.kt
@@ -81,7 +81,7 @@ class FieldViewModelFactoryImpl(
description = description,
valueType = if (optionSet != null && valueType == ValueType.TEXT) ValueType.MULTI_TEXT else valueType,
legend = legendValueProvider.provideLegendValue(id, value),
- optionSet = if(valueType == ValueType.MULTI_TEXT) null else optionSet,
+ optionSet = if (valueType == ValueType.MULTI_TEXT) null else optionSet,
allowFutureDates = allowFutureDates,
uiEventFactory = UiEventFactoryImpl(
id,