-
1. Re: How do I grab the left 50 char of a field.
George_Johnson Feb 13, 2014 7:06 AM (in response to BSisson)It seems to me it should be more like:
if (f.valueAsString.length > 70) {
var firstpart = f.valueAsString.slice(0,70); //this -SHOULD- be the first 70 char
var leftover = f.valueAsString.slice(71); //this -SHOULD- be the remainder.
s.value = firstpart;
position += 1;
s = this.getField("GeneralNotes."+ position);
s.value = leftover;
} else {
s.value = f.valueAsString; //stuff Export value into currnet Summary field
position += 1;
}
-
2. Re: How do I grab the left 50 char of a field.
GKaiseril Feb 13, 2014 7:17 AM (in response to BSisson)Maybe there is some other issue with your code.
Variables do not have a value property. They only have a value.
Have you tried adding some console.println statements to see what your code is doing and at what line it is failing?
if (f.value.length > 70) {
console.show();
console.clear();
console.println("length: " + f.value.length);
var firstpart = this.f.slice(0,70); //this -SHOULD- be the first 70 char
console.println("firstpart: " + firstpart);
var leftover = this.f.slice(71); //this -SHOULD- be the remainder.
console.println(("leftover: " + leftover);
console.println("set field value to " + firstpart.value);
s.value = firstpart.value;
position = position +1;
s = this.getField("GeneralNotes."+position);
f.value = leftover.value;
} else {
s.value = f.value; //stuff Export value into currnet Summary field
position = position +1;
}
//continue with the rest of the loop stuff...
-
3. Re: How do I grab the left 50 char of a field.
BSisson Feb 13, 2014 10:58 AM (in response to GKaiseril)Aha... the 'valueAsString' did it...
There was one more "position = position +1" needed as it was over writing the 2nd line with the next entry, but that was my error.
Now I have a summary form that builds its self conditionally from 750+ fields, and writs a nice summary that will nicely format response that are anywhere from 1-2 lines long.
.



