Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Sorting Data in a Dynamic Table - Need blank rows forced to the bottom after the sort.

nowackem
Level 3
Level 3

Hello All,

I have successfully utilized the sort table function within a dynamic table using the John Brinkman Sales Report file. It works beautifully, the magic is in the Variables script. It would be amazing to take this one step further and update the code to always list any blank rows at the bottom of the table no matter if the sort is ascending or descending. John's script does not account for this so if anyone can help me tweak this code to make that happen, I would be eternally grateful. 

My Designer PDF is located at the link below.

https://drive.google.com/drive/folders/1Qhz-DNYM40ECzUGEl2w34egEzhKBaaoV?usp=sharing

Thank you in advance!

 

1 Accepted Solution
Kosta_Prokopiu1
Correct answer by
Employee
Employee

I think I found a solution that works for different field types. If you want numeric input to be sorted numeric then your field must be Number or Decimal - otherwise it will sort as text.

https://documentcloud.adobe.com/link/review?uri=urn:aaid:scds:US:68787b63-a702-4977-b0c6-4968490fdfc...

View solution in original post

15 Replies
Kosta_Prokopiu1
Employee
Employee

Hi,

here is a bit of a hack that seems to do what you want based on the existing logic. Try it out by replacing the sortRoutine in the script object.

... the solution would not work under all circumstances - see my sample in a later post.

 

nowackem
Level 3
Level 3
Thank you so much! I appreciate your time. I replaced the sortRoutine script and realized when testing that it didn't force the blank rows to the bottom so if you have any ideas on what I can do differently I would love to hear them. Unfortunately using this updated script or my original script is crashing Designer in the HTML preview. Any advice or thoughts on how to make this work in both PDF/XDP and HTML for AEM would be appreciated.
Kosta_Prokopiu1
Employee
Employee
HTML is a whole new ballgame. Are you talking about an AEM Forms application where you render the XDP as HTML5 or Adaptive Forms?
nowackem
Level 3
Level 3
We are in the phase of building our 2000 forms from Word and Excel into Designer PDFs. Then we will take those and produce XDP files which will then be uploaded to AEM environment for publishing. We will eventually get them into Adaptive but for now, I'm trying to get them into XDP as HTML5 keeping in mind the end goal is Adaptive forms. We are a govt agency so its the path I have to take. Does that help explain my situation?
nowackem
Level 3
Level 3
I opened the file in Acrobat and it does not keep the blank row at the bottom of the table. I also see that if I use digits that vary in decimal placed they do not go in the proper order, i.e., 10 is a lower number than 3 in the sort. Is the sort working on your system?
Kosta_Prokopiu1
Employee
Employee
The sort is alphabetical, not numerical. What is supposed to be in those fields?
Kosta_Prokopiu1
Employee
Employee
HTML rendering works 90-95% but there are differences which you will have to cater for in your designs. See here https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwiJqa6JibDuA... around page 714 for differences between PDF and HTML
Kosta_Prokopiu1
Employee
Employee
Adaptive Forms are completely new approach. You can use the XDP as the "schema" to place fields and logic (to a degree) in your AFs but you would work on these forms more or less from scratch. You can use some AI service to convert PDF to AF (https://experienceleague.adobe.com/docs/aem-forms-automated-conversion-service/using/introduction.ht...)
nowackem
Level 3
Level 3
Thank you for all the information with the HMTL! This is helpful. I see now that this sort works alphabetically and it even works on the dates. This is a generic table that i'm working on for my team to use in their forms if the need arises. It could include numbers such as check numbers. Is there a way to cover both basis? This is kind of a template if that makes sense.
Kosta_Prokopiu1
Employee
Employee
My last post as it is late here in Germany. My trick does not work with numbers - only with strings - that is why it did not sort the empty columns for you. I guess that algorithm needs to be changed big time and we somehow need to check the field type. The table fields all seem to be interpreted as text. I have to think about it - we will talk next week.
Kosta_Prokopiu1
Correct answer by
Employee
Employee

I think I found a solution that works for different field types. If you want numeric input to be sorted numeric then your field must be Number or Decimal - otherwise it will sort as text.

https://documentcloud.adobe.com/link/review?uri=urn:aaid:scds:US:68787b63-a702-4977-b0c6-4968490fdfc...

View solution in original post

nowackem
Level 3
Level 3
Thank you so much for your help! This worked perfectly!