If the field is empty, how to populate it with another field's value?

Question

If the field is empty, is there a way to make it filled in with another field's value?

Answer

For example, if the Last Name/LName field is empty, it needs to be filled with the First Name/FName's value.

  1. Open Document Section properties, Rules tab.
  2. Here select the New rule... > Script
  3. In rule settings, add the necessary fields and make sure to unselect the Read-only for the field that will be populated with another field's value.
  4. Use the below script sample (C#) and replace the values in bold with the required values:
    if (Context.Field("LName").Text == "") {
    Context.Field("LName").Text = Context.Field("FName").Text;
    }
  5. Check the results.
    mceclip1.png
    mceclip3.png

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.