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

Question

Question

Sorting Entered Table Values Numerically

asked on November 21

I'm looking for some JavaScripting help for Forms v. 10.2.  I have a process where the users are asking that I sort data entered into a table in a previous task numerically, smallest to largest. 

 

Example:

User 1 submits a request including specified quantities in a table

User 2 receives a form that includes a read-only view of the table User 1 completed.  They must process the requested task from smallest quantity to largest. 

 

I've been unable to figure out how to sort the quantities in the table User 2 receives. 

 

Any ideas?   

2022-11-15_12-23-49.jpg
0 0

Replies

replied on November 21 Show version history

This is definitely doable via Javascript.  But just a thought...

Since you are wanting a table submitted on one user task to be sorted when it shows on another user task - it might actually be easier to do this in Workflow, in between the two user tasks.  Have Workflow pull the table values, sort them, and push them back into the table.  In that case, they will actually be saved in the sorted order instead of just displayed in a sorted order via Javascript.

1 0
replied on November 21 Show version history

If you definitely want to use Javascript instead of Workflow, perhaps you can start with the code from this post (that was written on 10.2): https://answers.laserfiche.com/questions/113991/Table-Rows-Position#114060

It is about moving rows up or down, but should be a good basis for starting to code a solution that automatically sorts the table (sorting a list in code is usually just done by iterating through each value and moving it before or after the values around it so code that can move a table row up or down is a good starting point).

I still think Workflow will be a much easier solution, so I definitely recommend that over doing a Javascript solution here.

0 0
replied on November 22

I hadn't even thought of Workflow!  I'll definitely explore that option.  Thank you for your help!

1 0
replied on November 22

Usually that’s my downfall.  I work up some super cool (but overly complicated) bit of code, and then realize later there was a much easier way to do it using built-in functionality.  Haha

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

Sign in to reply to this post.