Skip to main content
Participant
October 6, 2020
Question

Could someone help his newby to java correct these errors, I'm having no luck on my own.

  • October 6, 2020
  • 2 replies
  • 1026 views

var R = this.getField("Renter").valueAsString;
var R2 = this.getField("Renter2").valueAsString;
var L = ("Lessee");
var NULL = ""
if ("R2" != NULL);
(R + " " + "and" +" " + R2);
          else
L = R ;

This topic has been closed for replies.

2 replies

Inspiring
October 6, 2020

I think you want to do this:

 

var R = this.getField("Renter").valueAsString;
var R2 = this.getField("Renter2").valueAsString;
var L = "Lessee";
var NULL = "";
if (R2 != NULL) {
    event.value = R + " and " + R2);
} else {
    event.value = L;
}

 

I'm assuming this is a custom calculation script. 

Inspiring
October 6, 2020

On second thought, something like this is probably better:

 

var R = this.getField("Renter").valueAsString;
var R2 = this.getField("Renter2").valueAsString;
var L = "Lessee: ";

if (R2) {
    event.value = L + R + " and " + R2);
} else {
    event.value = L + R;
}

 

Nesa Nurani
Community Expert
Community Expert
October 6, 2020

Remove parentheses next to + R2)

Inspiring
October 6, 2020

You need to explain what you try to achive?

Participant
October 6, 2020

I am trying to  use two fields, "Renter" and "Renter2" to fill a field "Lessee". If only one renter then that name only is placed in Lessee field. If two renters  then Renter + Renter2 are placed in Lessee field seperated by "and"  ., Like "Geo Everybody and Harold Nobody" This for filling in a Lease form.