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

Question

Question

best way to add row as last row when using Set Business Process Variables

asked on July 5, 2018 Show version history

I have a form that cancels other forms. The cancel comments get saved to a database table. On the form I want to cancel, I am using Workflow to query the comments (and other metadata) and add them to this forms comments (table variable). My issue is that when I add the cancel comments in using Set BP Variables, it appears as the top row:

 

 

I need this row to be at the bottom. Is there anything I can do at the Workflow level to achieve this? 

 

Thanks,

 

Chris

0 0

Replies

replied on July 5, 2018

It is just going to spit it out in the order SQL does.

My recommendation would be to sort it in SQL by your date time field. To do this you would need to switch workflow to use the Custom Query activity and use an ORDER BY clause.  Alternatively you could create a SQL view that has it presorted and then utilize that instead instead of the table you are looking at.

 

There are ways to manipulate multi value variables as well, and you could look at the For Each Row functions populating other tokens while skipping the cancel row and then appending it to the end, but when having to resort an entire table, I would not recommend it.

1 0
replied on July 5, 2018 Show version history

I have moved on from this. I ended up making the 'Cancellation Comments' appear in a separate table as an alert to the reviewer. I could get the top row to move to the bottom row, but the variable didn't keep those changes after submitting the form. Here is that code for moving the top row to the bottom in case it can help someone down the road:

//on load if 'cancel request' is in top row of comments, move to bottom
  var tr = $('#tableName tbody tr:first-child').remove().clone();
  $("#tableName tbody").append(tr);

^I got to learn how the .clone() method(I think??) works. Pretty handy.

Thanks

1 0
replied on April 6, 2021 Show version history

I know this is a bit of an older thread but I thought I would add that I changed the code to work with a collection as well. "CollectionOne" is my collection's class name.

 

    var Row = $('.CollectionOne .kx-repeatable > div:first').remove().clone();
    $(".CollectionOne .kx-repeatable > div").append(Row); 

EDIT: if I call it twice it causes issues... so ignore for now.

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

Sign in to reply to this post.