Skip to main content
Participant
February 17, 2025
Question

Benannte Felder zählen, wenn Sie einen Wert enthalten

  • February 17, 2025
  • 1 reply
  • 217 views

Ich habe ein Formular mit den Textfeldern für Wochentage Montag - Sonntag. Ich möchte die Felder zählen, in den ich einen Zahlwert eingetragen habe um zu ermitteln, ob ich eine 5 oder 6 Tage Woche erhalte. Hat jemand eine Idee?

1 reply

try67
Community Expert
Community Expert
February 17, 2025

So you want to count how many fields in a group are filled in, basically? What are the names of those fields?

Participant
February 17, 2025

Mo Di Mi Do Fr Sa So

try67
Community Expert
Community Expert
February 17, 2025

OK, then you can use this script as the custom calculation script of a text field to show how many fields in the group have a value:

 

var fields = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"];
var cnt = 0;
for (var i in fields) {
	var f = this.getField(fields[i]);
	if (f.valueAsString!="") cnt++;
}
event.value = cnt;