How to identify which Datatable is not empty

Hi there,

I have my designed shown like the following, where I have 6 drawings available to be filled out:

Once the drawing datatable is filled, I want to use the "Drawing Present" textbox to keep track of how many drawings are filled among the 6 drawings. How do I achieve it?

I would like the Drawings Present to store something like "Drawing #1 Drawing #2 ...". If a specific drawing number is deleted, I want the Drawing Present textbox to delete that as well.

And how do I automatically select the check box when a datatable is filled. So users don't have to manually select the checkbox. Thanks.

How do I achieve this?

Thanks,emphasized text

Hello @jyou,

You can call the function when a user change the data table. The function checks if the table contains entries and populates other fields. This is the code example for one DataTable control:

fd.control('Drawing1').$on('change',function(value) {
  var checkBox = fd.field('Drawings').value;
  //add the option if the table has enteries
  if(value.length > 0 && !checkBox.includes('Drawing 1')){
      checkBox.push('Drawing 1')
  //remove the option if the table has no enteries
  if(value.length < 1 && checkBox.includes('Drawing 1')) {
    var index = checkBox.indexOf('Drawing 1');
    if (index > -1) {
      checkBox.splice(index, 1);

  //populate fields
  fd.field('Drawings').value = checkBox;
  fd.field('Drawings').selectedOptions = checkBox;
  fd.field('DrawingsPresent').value = checkBox.join('; ');

Make sure you are using valid fields' and controls' names in the code.


Thank you. your solution works perfectly. :slight_smile: :grin:

1 Like

Hi @mnikitina ,

I am just wondering How can i make my code more effective if I don't want to include the checkboxes, just textfield to store which drawing tables are present?

And I realize that using the checkboxes, after the form is saved and reopened, all the selections on the checkboxes are gone.



Could you provide more information about your case so I can suggest a better option.

Why do you need to keep this information in a separate field? Do you want to perform any actions based on this information?

@mnikitina everything is good now. I have fixed it. Thank you.

1 Like