Skip to main content
Participant
June 10, 2016
Answered

Fill a field with a value only if another field has been filled?

  • June 10, 2016
  • 1 reply
  • 754 views

I'm looking to fill a field with a predetermined value only if another field is not blank. I have no idea how to do this.

Any help would be appreciated.

Thanks

This topic has been closed for replies.
Correct answer try67

Use this code as the custom calculation script of LineRow1:

event.value = (this.getField("SourceDescriptionRow1").valueAsString=="") ? "" : "001";

1 reply

Inspiring
June 10, 2016

You will need to provide specifics about the field names their values, and what value you want placed in the target field for the value placed in the input field.

You need to use the custom JavaScript. There are a couple of possible ways to do this. One uses conditional execution statement like "if" or "switch", another could be done using an array.

Participant
June 10, 2016

ok, to be specific I have a line field (LineRow1) which should have the value 001 if the description field has anything entered (SourceDescriptionRow1)

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
June 10, 2016

Use this code as the custom calculation script of LineRow1:

event.value = (this.getField("SourceDescriptionRow1").valueAsString=="") ? "" : "001";