Skip to main content
Participant
Feb 17, 2025 2:42 PM UTC
Question

Benannte Felder zählen, wenn Sie einen Wert enthalten

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?

3 replies

try67
Community Expert
Community Expert
Feb 17, 2025 3:10 PM UTC

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

Translate
Participant
Feb 17, 2025 3:49 PM UTC

Mo Di Mi Do Fr Sa So

Translate
try67
Community Expert
Community Expert
Feb 17, 2025 3:56 PM UTC

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;
Translate