You are viewing limited content. For full access, please sign in.

Question

Question

Gateway for all rows must

asked on January 17, 2022

For a form where there are multiple tasks listed in a table and the user(s) must come in and mark them complete before the form moves on.  It loops back to the user task until one of the users fills in another field saying all tasks complete.  I don't like depending upon users to see and fill in that field outside of the table.  How can I use a Gateway control that is watching all the rows?  I'm looking for an outflow path of something like:  

  • /dataset/Tasks_Required="Completed"  where a radio button would have choices of Incomplete or Completed
  • and it would not take the path to move forward unless ALL the rows had that choice.
0 0

Replies

replied on January 17, 2022

You might be able to use many OR statements in the Process Diagram Condition, but I would give the radio button choices alternative values of 0 or 1, then add them all together to see if the total equals the total number of tasks.

You could also hide the submit instead of simply re-assigning the task. They can still save as draft when the submit button is hidden, but can not submit.

1 0
replied on January 17, 2022

Oh, interesting idea, Chad, to add up all the numbers.  I thought that might work for me until I realized my form does not have a set number of rows.  Can we make it count how many rows first and then know what the number should be?

0 0
replied on January 17, 2022

You could count the total number of radio buttons, or getting the row count should be easy as well. Here is a post with the javascript for getting the row count, same logic should also work just for your radio button count.

https://answers.laserfiche.com/questions/83713/How-to-Count-Amount-of-Rows-in-a-Table#83727

I am sure this can also be done using calculations.

0 0
replied on January 17, 2022

Ya, JS might be the answer, count the rows, then fill a hidden Number field upon hitting submit, then the Gateway would somehow be programmed to say total up the radio button choices and if they match... ah ___, I don't know how to do either one of those things.  Help!

1 0
replied on January 17, 2022

Just total up the selections with javascript or calculations. WIth calc I know there is a SUM function.

0 0
replied on January 20, 2022

OK.  I have something that works...

 

Here's the Javascript that will fill in the Number of Rows:

$(document).ready(function() {
  
  rowcount();

  $('.mytable').on('click', '.form-del-field', function () {
    rowcount();
  });
  
  $('.mytable').on('click', '.cf-table-add-row', function () {
    rowcount();
  });
  
  function rowcount() {
    $('#q5 input').val($('.mytable tr').length-1);
  }
});

 

Here is the calculation for number of completed status values:

Here is the calculation for the difference

And here is the process diagram:

It worked for me.

 

 

1 0
replied on January 21, 2022

Interesting, Katy!  Thanks for all that.  I am able to match what you've done and will be able to use it!  

I have one question:  In your JS, what field is #q5 Input?

0 0
replied on January 24, 2022

The Number of Rows:

0 0
replied on January 18, 2022

Do you have a picture of this field/table?

 

0 0
replied on January 19, 2022

Here you are Katy.  My goal is to get the form to know to move out of the loop to the final steps once ALL the Status buttons show as Completed.

0 0
replied on January 19, 2022

Using javascript this should tell you if they completed all of the radio buttons

 let total = 0;
  
//assuming a class name assigned of 'status'
//total up all radio alternative values, where completed = 1
  $('.status input').each(function(){
  
    total+=Number($(this).val());
  
  });
  
  
  if(total == $('.status').length)){

//The total is equal to the total number of status radio buttons
//We can show the submit button, or enter a value into a hidden field to be used in
//a process design condition

 }

 

0 0
replied on January 19, 2022

Thanks, Chad!  So, I know enough to know that if I use this as is, it won't work bc there needs to be more parts.  I have other JS on the page, but just something small.  So I'll need to start this one with the same beginning of the other one, right? 

$(document).ready(function () 
{

and end it with something that tells it what to do after your if statement.  How would I tell it to make the second submit button show up instead of the first one if the if-statement is true?

  • Finished My Task (other tasks still incomplete)
  • All Tasks Complete

 

0 0
replied on January 19, 2022 Show version history

If this is your first time using javascript you will want to start here:

https://doc.laserfiche.com/laserfiche.documentation/en-us/Default.htm#../Subsystems/ProcessAutomation/Content/Forms-Current/Javascript-and-CSS/Javascript%20Selectors.htm

I highly recommend taking a day to learn the basics given the complexity of the forms your building, it is very powerful and well worth it. Mostly you want to learn why the ready method is needed, some basic jquery methods, how to use the browser console for testing, and how the HTML DOM layer works.

So it would look something like this

$(document).ready(function(){

//Hide Submit
$('.Submit').hide();
//Each time user changes a status, check to see if all are complete
$('.status input').change(CheckForAllComplete);

//your existing code can remain here

}



function CheckForAllComplete() {

 let total = 0;
  
//assuming a class name assigned of 'status'
//total up all radio alternative values, where completed = 1
  $('.status input').each(function(){
  
    total+=Number($(this).val());
  
  });
  
  
  if(total == $('.status').length)){

//Show submit
//Using the optional 300 parameter causes the button to show over 300ms
//This is important when you want the user to see that something new has become available
$('.Submit').show(300);

 }

}

 

0 0
replied on January 19, 2022

Thanks, Chad!  I will be playing with this over the next few days.  Pulled off the project just now, but hope to get something working before the end of the week.

0 0
replied on January 20, 2022

If all status' need to be complete, why do you have the required radio button and not just 2 radio buttons where you could have a hidden field that would compare the number of rows in the table to the sum of the status field with incomplete = 0 and complete = 1?  If the value of the number of rows and the value of the Sum of the status field are equal, move forward, else loop back.

0 0
replied on January 20, 2022

Katy, I have tried a number of different things with this form and I confess there are a few hang-over pieces left in from different options we tried.  Thanks for your comments, I will have another look and will be making some changes.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.