We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.
Hi - I am still learning how to write scripts in Adobe Pro DC. On the left side of my form, it requires a user to enter data. After I have that data entered, I need it to sort on the right side of the form. This is more complicated than anything I have ever tried to do.
Is it possible to take values entered in column 19 and sort them least to greatest?
If that is possible -next, is it possible to also pull in data from other columns on that same row?
Screenshot of worksheet is attached. I highlighted the columns I need to have sort on the right side.
Thank you for any assistance -
Yes, this is all possible. The general approach would be:
- Collect the data from the source fields and place the values into an array.
- Sort the array using a simple function and the sort method. See: https://www.w3schools.com/js/js_array_sort.asp
- Iterate over the sorted array and write the values from it, in order, to the target fields.
Oh my goodness thank you for taking time to reply to me. And for being patient - I'm sure my next question will sound a little ignorant. I am mostly self-taught, so I may not get the terms right.
Can I directly link the source fields into the array? So it automatically references fields 19a, 19b, 19c, and so on (with something like: get.thisField("19a").value)?
Or is the only way to do this is for me to manually plug in the values?
Thanks again - I need all the help I can get.
Ugh I cannot even get my stuff right here. What I meant was by using ---- this.getField ("19a").value
not - get.thisField -- sheesh.
Put the values in a array and sort the array.
There are no fields on the right side of the form. Where exactly do you intend to write sorted numbers?