Copy link to clipboard
Copied
Hi, how can I sum up the following values?
[A-H]&[J-U]&[W-Z]
[a-z]
[I,II, III, IV, V, VI, VII]
if (event.value=="A") { event.target.textColor = color.red;
this.getField("Field1").textColor = color.red;
this.getField("Field2").textColor = color.red;
this.getField("Field3").textColor = color.red; }
else if (event.value=="B") { event.target.textColor = color.red;
this.getField("Field1").textColor = color.red;
this.getField("Field2").textColor = color.red;
this.getField("Field3").textColor = color.red; }
else if (event.value=="C") { event.target.textColor = color.red;
this.getField("Field1").textColor = color.red;
this.getField("Field2").textColor = color.red;
this.getField("Field3").textColor = color.red; }
else if (event.value=="D") { event.target.textColor = color.red;
this.getField("Field1").textColor = color.red;
this.getField("Field2").textColor = color.red;
this.getField("Field3").textColor = color.red; }
else if (event.value=="a") { event.target.textColor = color.red;
this.getField("Field1").textColor = color.red;
this.getField("Field2").textColor = color.red;
this.getField("Field3").textColor = color.red; }
else if (event.value=="b") { event.target.textColor = color.red;
this.getField("Field1").textColor = color.red;
this.getField("Field2").textColor = color.red;
this.getField("Field3").textColor = color.red; }
else if (event.value=="c") { event.target.textColor = color.red;
this.getField("Field1").textColor = color.red;
this.getField("Field2").textColor = color.red;
this.getField("Field3").textColor = color.red; }
else if (event.value>=0) { event.target.textColor = color.black;
this.getField("Field1").textColor = color.black;
this.getField("Field2").textColor = color.black;
this.getField("Field3").textColor = color.black; }
else if (event.value=="I") { event.target.textColor = color.green;
this.getField("Field1").textColor = color.green;
this.getField("Field2").textColor = color.green;
this.getField("Field3").textColor = color.green; }
else if (event.value=="II") { event.target.textColor = color.green;
this.getField("Field1").textColor = color.green;
this.getField("Field2").textColor = color.green;
this.getField("Field3").textColor = color.green; }
else if (event.value=="III") { event.target.textColor = color.green;
this.getField("Field1").textColor = color.green;
this.getField("Field2").textColor = color.green;
this.getField("Field3").textColor = color.green; }
else if (event.value=="IV") { event.target.textColor = color.green;
this.getField("Field1").textColor = color.green;
this.getField("Field2").textColor = color.green;
this.getField("Field3").textColor = color.green; }
else if (event.value=="V") { event.target.textColor = color.green;
this.getField("Field1").textColor = color.green;
this.getField("Field2").textColor = color.green;
this.getField("Field3").textColor = color.green; }
else event.target.textColor = color.blue;
as well I would like to sum up the "get.Field" method. I tried this:
this.getField(["Field1","Field2","Field2"]).textColor = color.red;
but it didn't work
can you please help me?
OK, then I would do it like this:
var newTextColor = color.black;
var romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII"];
if (romanNumerals.indexOf(event.value)!=-1) {
newTextColor = color.green;
} else if (/^\d+$/.test(event.value)) {
newTextColor = color.blue;
} else if (/^[a-z]+$/i.test(event.value)) {
newTextColor = color.red;
}
var fields = ["Field1", "Field2", "Field3"];
for (var i in fields) this.getField(fields).textColor = newTextColor;
Copy link to clipboard
Copied
Are these the only options?
Copy link to clipboard
Copied
what do you mean with the only options?
edit:
there's a table with 30 rows and 3 columns. actually there are more options. field 1-3 only represents one row in this table
the color of one row should depend on the value that ist entered in the target field
Copy link to clipboard
Copied
I mean if the only options are the lower and upper case letters and I-VI in Roman numerals.
Copy link to clipboard
Copied
the options are lower and upper case letters, roman numerals I-VII and numbers
Copy link to clipboard
Copied
OK, then I would do it like this:
var newTextColor = color.black;
var romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII"];
if (romanNumerals.indexOf(event.value)!=-1) {
newTextColor = color.green;
} else if (/^\d+$/.test(event.value)) {
newTextColor = color.blue;
} else if (/^[a-z]+$/i.test(event.value)) {
newTextColor = color.red;
}
var fields = ["Field1", "Field2", "Field3"];
for (var i in fields) this.getField(fields).textColor = newTextColor;
Copy link to clipboard
Copied
trompete111 schrieb
what do you mean with the only options?
edit:
there's a table with 30 rows and 3 columns. actually there are more options. field 1-3 only represents one row in this table
the color of one row should depend on the value that ist entered in the target field
What are the field names in the other rows?
Copy link to clipboard
Copied
well I think I'll just number them eg Field11, Field 12, Field 13, Field 21, Field22, Field23,.. are there any other options?
thank you try67 this is exactly what I was searching for. but i don't really understand wherefore you define
is this because of the presetting of the color? so that every field with the preset textcolor black is affected on the entered value or is it just random?
Copy link to clipboard
Copied
That's in case the value doesn't match any of the conditions.