FACE Templating, Jinja, Sorting, Replacing, and dictsort, and natural sort

FACE Templating, Jinja, Sorting, Replacing, and dictsort, and natural sort

Hello,

After some research it looks like Face is a derivative of python's Jinja templating system. 

This is great in the sense that there is actually some rather comprehensive documentation and examples online that can loosely be used to diagnose some issues in your own Face code, but there seem to be enough deviations from Jinja to occasionally make it a little aggravating.

With this in mind, some experimenting has led me to discover two undocumented filters that are quite useful for those using Face.  (I imagine there are probably others):  

The Sort Filter:

The following appears to work as an undocumented "sort" filter:

{% sorted_values = presorted_values | sort(attribute="value") %}


This would appear to corollate to the functionality in Jinja's implementation as described here:


The Replace Filter:

Another is the "replace" filter.  The following code works:

{% sorted_options = sorted_options | replace("}{","},{") %}


This would appear to corollate to the functionality in Jinja's implementation as described here:


The one however that has me a bit stumped is that the documented Face filter "dictsort" does not seem to do anything particularly useful insofar as I can tell - at least for my application.

In my case, I'm trying to sort key:value pairs in Zoho Commerce.  To be more specific, I'm trying sort a list of attribute options by the option name (or value) rather than the option id (which really is only useful in knowing the order in which a set of options was entered, as they're always assigned such that each one is id'd higher than the ones before).

The following is Zoho's documentation for Face's dictsort implementation:

 dictsort

This filter sorts the given values in dictionary, i.e., alphabetical order.

 

Syntax

{{ map_variable | dictsort }}

 

Example

{ % assign map2="{"ant" "black""dog" : "brown" "cat" : "yellow"} %}


{{ map2 | dictsort }}

 

Output

{ant=black, cat="yellow," dog="brown}


The description is a bit vague and doesn't really explain what dictsort does.  Based on the description alone, I might assume that it would be sorting based on the value.  This is not the case.  By looking at the example, it's actually sorting key/value combinations based on the key (the option id in my case) - not the value.

Hoping that the Jinja guide to provide some additional reference, it appears that the jinja dictsort filter should allow you to sort by value: 
{% for item in mydict|dictsort(false, 'value') %}
    sort the dict by value, case insensitive
Unfortunately, I can't seem to get this working in Face in similar fashion.

Given its usefulness - especially for applications related to Zoho Commerce, can Zoho please expand dictsort to more closely mirror the behavior of the Jinja implementation to support sorting based on values instead of keys?

Lastly, I'd like to ask that Zoho might consider implementing one other filter type.  There are several situations in which you might have options, product descriptions, or the like that are sequenced numerically.  For example, if I'm selling lightbulbs, my attributes might be something like: 

50 Watt
75 Watt
100 Watt

If I sorted these using a dictionary sort, they would end up as:

100 Watt
50 Watt
75 Watt

(This same problem is shown when sorting numeric skus in Inventory) 

This of course is because 1 sequentially comes before 5, but the sorting code doesn't recognize that the value 100 is greater than the value of 50.

It would be far better to have a "natural sort" filter.  If python is fact the backend for Face, the code shown here might be useful in doing do:


Thanks,
Bryan


    Access your files securely from anywhere







                            Zoho Developer Community





                                                  Use cases

                                                  Make the most of Zoho Desk with the use cases.

                                                   
                                                    

                                                  eBooks

                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                   
                                                    

                                                  Videos

                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                   
                                                    

                                                  Webinar

                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                   
                                                    
                                                  • Desk Community Learning Series


                                                  • Meetups


                                                  • Ask the Experts


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner




                                                            • Sticky Posts

                                                            • SEO for your Zoho Sites Website

                                                              Join our live webinar to learn how to use Zoho Sites' SEO tools to boost your website's ranking. Our product specialist will demonstrate everything you need to know about optimizing your web pages to make them search engine friendly. Register here for free: https://www.zoho.com/sites/webinars/
                                                            • Website Accessibility

                                                              I have two sites created in Zoho Sites which are both live. Some questions: 1. Are any of the template themes WCAG 2.1 AA compliant? 2. How do I change the format of a sub-heading in the header section? 3. Is there any way to add focus indication for
                                                            • Unveiling Zoho Sites 2.0 - A new dimension in website building

                                                              Dear Zoho Sites Users, We are thrilled to announce the launch of Zoho Sites 2.0 today! This refresh represents a significant step forward in the capabilities of Zoho Sites and is crucial for creating a lasting and positive impact on our customers' businesses.
                                                            • Visual Editor Webinar

                                                              Join our FREE live webinar to learn how to use the Zoho Sites Visual Editor to easily design your website. Our product specialist will demonstrate how this tool will help you customize your website to suit your requirements.  Register here: https://www.zoho.com/sites/webinars/
                                                            • Zoho Sites Webinar | Integrations

                                                              Join our FREE live webinar to learn how to integrate both Zoho and third-party products with your Zoho Sites website. Our product expert will demonstrate how to use these integrations to grow, manage, and retain the customers you bring in. Learn how to take your business forward and build stunningly robust and efficient websites. Register here: https://www.zoho.com/sites/webinars/


                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • Functions

                                                                                        Functions

                                                                                      • Meetups

                                                                                        Meetups

                                                                                      • Kbase

                                                                                        Kbase

                                                                                      • Resources

                                                                                        Resources

                                                                                      • Digest

                                                                                        Digest

                                                                                      • CRM Marketplace

                                                                                        CRM Marketplace

                                                                                      • MVP Corner

                                                                                        MVP Corner







                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ








                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方




                                                                                                            • Recent Topics

                                                                                                            • Urgent: How to Bulk Upload Images in Zoho Inventory? Any Workarounds?

                                                                                                              We are currently onboarding 5,000+ items from Shopify into Zoho Inventory, but we’re struggling with the lack of a bulk image upload feature. Right now, we have to manually upload and assign images one by one, which is extremely time-consuming and inefficient.
                                                                                                            • Can I automatically update COGS and Inventory account when creating an item?

                                                                                                              I have been trying to get Zoho to update the other two fields when I update one (Sales Account, COGS account, and Inventory Account). I know this seems like not a huge time saver, but I am all about efficiency and being an independent taproom, I create
                                                                                                            • I'm looking for a Microsoft List alternative in Zoho One to manage large lists of repetitive tasks

                                                                                                              I've used Microsoft Lists to manage lots of tasks that need to be completed several times for different users. We started with a large spreadsheet and then discovered lists, which worked pretty well. I was wondering if there is a similar products in Zoho,
                                                                                                            • Zoholics Europe and UK Awards 2025: Honouring our loyal customers!

                                                                                                              We're excited to announce that at this year's Zoholics events across Europe, we're holding customer awards for the first time ever! This is your chance to shout about the amazing things you've created, connected, or achieved with Bigin! And if you win,
                                                                                                            • Fillable template with dynamic tables?

                                                                                                              Is there a way to build a fillable template so that users can add rows to a table? To describe what I'm trying to accomplish the table has 3 sections; a header row, some number of rows with custom information, and a summary row with totals. I can't figure
                                                                                                            • How to store API keys in zoho?

                                                                                                              Hi everyone, I'm currently building an integration using Zoho Flow and I need to securely store several API keys that will be used to make external service calls from my flows. I would not like to hardcode the values in the code of custom function. What's
                                                                                                            • Zoho RPA is now available in your Zoho One bundle!

                                                                                                              Hello All! Of late, it's been quite a stint of new app integrations in Zoho One. This announcement pertains to the addition of another Zoho application, the most sought-after Zoho RPA - Robotic Process Automation, to the bundle. What is Zoho RPA? Zoho
                                                                                                            • is there an easy way to embed a zoho analytics report into a widget (or inside the "account" page) of Zoho CRM

                                                                                                              Hi, I have built a report that is specific to an account in Zoho CRM but I would like this to be built into the Zoho CRM front-end. I have looked at the widget concept but it seems quite complicated (see attached screenshot but I need to filter this view
                                                                                                            • Bigin iOS app update - Introducing Card Scanner and initiating WhatsApp conversations using pre-approved templates.

                                                                                                              Hello everyone! In the latest iOS (v1.11.3) version of the Bigin app, we have introduced the following features: Card Scanner Initiating WhatsApp conversations. Card Scanner: Our new Card Scanner feature extracts contact information from business cards.
                                                                                                            • Introducing card scanner in Bigin Android app

                                                                                                              Hello everyone! We are excited to introduce the card scanner feature on the latest Android version(1.7.26) of the Bigin app as well. Card scanner extracts contact information from business cards and allows you to save them as contacts in Bigin. You can
                                                                                                            • Full RTL and Hebrew Translation Support for Zoho Creator User Portal (Including All System Pages, Templates, and MFA Screens)

                                                                                                              Dear Zoho Creator Team, We kindly request comprehensive support for right-to-left (RTL) languages, particularly Hebrew, across the entire Zoho Creator user portal. This includes system-generated pages, templates, and multi-factor authentication (MFA)
                                                                                                            • ZUG real estate virtual meetup 2025: Sign documents, collect payments, and automate workflows with Zoho Sign

                                                                                                              Hi there! Are you in real estate and looking for a secure, compliant way to manage all your paperwork? In such a fast-paced industry, timing, compliance, and client trust are everything. Handling paperwork has always been a challenge, whether you're finalizing
                                                                                                            • OCR (Optical Character Recognition), automatisation des PDF et autres améliorations de Zoho RPA

                                                                                                              Zoho RPA est une plateforme d'automatisation des processus robotiques conçue pour accélérer et simplifier vos workflows. Elle permet de connecter facilement vos applications cloud à vos systèmes existants, même ceux qui ne disposent pas d’API, afin d’automatiser
                                                                                                            • 📞 Call + 💬 WhatsApp + 📲 SMS in Zoho CRM – All in One Place!

                                                                                                              We’re excited to introduce HelloSend, a powerful communication extension for Zoho CRM that brings SMS, WhatsApp, and Voice Calling directly into your CRM workspace. Whether you're in sales, support, or service delivery, HelloSend helps you connect with
                                                                                                            • Automation#24: Auto-Update custom field from Accounts to Tickets

                                                                                                              Hello Everyone! Welcome back to the Community Learning Series! This episode dives into how Zylker Techfix streamlines account-related ticket references. Previously, employees had to manually check account details to retrieve specific customer information,
                                                                                                            • Product Updates in Zoho Workplace applications | May 2025

                                                                                                              Hello Workplace Community, Let’s take a look at the new features and enhancements that went live across all Workplace applications this May. Zoho Mail Increased Preset Limit for Reminder and Snooze Options Preset limits for the Reminder and Snooze options
                                                                                                            • Outlook 365 ('classic') won't connect to Zoho email

                                                                                                              New computer, fresh install of Office desktop. On the old computer Outlook was working fine with Zoho, retrieving/sending mail, etc. On the new one I can't connect the accounts in Outlook--Outlook just keeps popping up the box asking for a password. All
                                                                                                            • login email

                                                                                                              Never logged into email says last log in never loged into
                                                                                                            • Installment plans

                                                                                                              Hi I am looking for a way to allow my customer to make equal monthly payments. For instance if I create an invoice for customer Y for $1000 I want to allow them to make equal monthly payments for the next 6 months. I need those payments to be auto charged
                                                                                                            • Search Mail with URL parameters

                                                                                                              Is it possible to search Zoho Mail by passing URL params like we can in Gmail? eg. mail.google.com/mail/u/0/#search/from:(jane@doe.com)
                                                                                                            • Need Help Fetching Latest Conversion Rate by Date

                                                                                                              Hi Team, I’m currently working on building a Balance Sheet in Zoho Analytics across different entities, with a common base currency of USD. I receive USD conversion values on a daily basis, and my requirement is to always capture the most recent available
                                                                                                            • Enhance Zoho One Conditional Assignment to Fully Reassign App Settings When Changing Departments

                                                                                                              Hi Zoho Team, We’d like to submit a feature request regarding the current behavior of Zoho One’s conditional assignment logic when moving a user between departments. 🔧 Current Limitation As it stands, Zoho One’s conditional assignment does not remove
                                                                                                            • Category to Alert

                                                                                                              Hi I am looking for help on how to solve an issue. We use the Category field for all items. We also use Composite Items. We would like to create an email alert when a Sales Order is created, however it would need to look at the Item to identify the category
                                                                                                            • Validation Rule (Date)

                                                                                                              Hi There,  Can any anyone help me with the validation rule? I'm trying to fire a rule whereby the End Date cannot be before Start Date.  Any takers?  Manoj Nair
                                                                                                            • Beyond Email: #3 Organize effortlessly with Bookmarks

                                                                                                              With her team’s details now neatly saved under Contacts, Sarah is feeling more settled in Zoho Mail. As she begins exploring her new workspace, she remembers the collection of useful links she has saved on her browser—project trackers, client portals,
                                                                                                            • Notification based on created/updated sales order that contain certain line items.

                                                                                                              Hi, I am finding the workflows within Books somewhat difficult to setup, so I am thinking that a custom function may be the best way to go about this. I want to be able to send a notification to a team member that any sales order that has been created
                                                                                                            • Drawings in forms

                                                                                                              I do a lot of drawings during my consultations and I’d like to add  body maps or stencils that I can draw on in different colours and add explanations etc. I need to be able to erase mistakes etc. Ideally in a form that I can prepopulate with client details and a few questions/ client signature and then save as a form. is this currently possible? if not, is it in the pipeline? thanks, Dennis
                                                                                                            • How can I populate dropdown data with information from another source or app?

                                                                                                              I want to maintain a list of items in another app (say in excel or another database) and sync those as items in a drop down menu, instead of copy pasting to import. Is this kind of a feature available?
                                                                                                            • Workplace - Zoholics Europe Customer Awards

                                                                                                              Dear Zoho Mail Community! 📣 We're excited to announce that at this year's Zoholics events across Europe, we're holding customer awards for the first time ever! Workplace - Zoholics Europe Customer Awards This is your chance to shout about the amazing
                                                                                                            • Zoholics Europe Customer Awards

                                                                                                              Dear Zoho Workplace Community! 📣 We're excited to announce that at this year's Zoholics events across Europe, we're holding customer awards for the first time ever! Workplace - Zoholics Europe Customer Awards This is your chance to shout about the amazing
                                                                                                            • Change Default Currency in Zoho Reports

                                                                                                              Is it possible to default all currency fields in my Reports and Tables to my local currency without having to reformat them every time?
                                                                                                            • [Webinar] Deluge Learning Series - Master Conditional & Operational Logic in Zoho Deluge

                                                                                                              We’re excited to bring you the next session in our Deluge Learning Series—a focused one-hour webinar where you’ll level up your skills in conditional and operational logic using Deluge scripting. From writing clean if-else conditions to implementing powerful
                                                                                                            • UPI QR Code in Invoices

                                                                                                              Hi, It would be easier to make payment, if UPI Qr code is generated by Zoho Books and shown in the invoice itself.  This will promote digital payments and also makes it easier for customers to pay. It would be even helpful, if QR code contains the invoice
                                                                                                            • WebDAV support

                                                                                                              I need WebDAV support so that I can upload/download (and modify) documents from my local file system. Is anything planned in his direction?
                                                                                                            • Recurring Events Not Appearing in "My Events" and therefore not syncing with Google Apps

                                                                                                              We use the Google Sync functionality for our events, and it appears to have been working fine except: I've created a set of recurring events that I noticed were missing from my Google Apps calendar. Upon further research, it appears this is occurring
                                                                                                            • Zoho Inventory Item History

                                                                                                              Hi Zoho Inventory Team, I 've been testing the History feature on Inventory Items in a demo system and I noticed that when I changed the value of a field to a new value, the history just says "updated by - user1", it doesn't say what what field was changed
                                                                                                            • Filter Images in Work Drive

                                                                                                              Hi, what is the best way to be able to filter files by multiple descriptions, for example, the name of a person in the photo as well as, an item in the photo and other descriptions? With labels it looks like you can only select one label at once but this
                                                                                                            • Flow not working when trying to Create a Merged Doc with info from a custom CRM module w/ subform

                                                                                                              I am having a problem creating a flow that gets its info from a webhook connected to a button in a custom module in Zoho CRM. I have made a template in Writer that follows: This is a clone of  the template in the CRM mail merge which works perfectly if i do it manually through there. My flow gets the custom module entry id through a webhook, then fetches the module entry data, and creates a merge document from that data. I know the webhook and the fetch work because if i replace the "create merge
                                                                                                            • Smart Scheduling via Agent Confirmation

                                                                                                              We’re excited to introduce a smarter and more streamlined way to manage dispatched service appointments in Zoho FSM! Feature Highlights Field agents can now approve or reject service appointments assigned to them—helping reduce unnecessary workload and
                                                                                                            • How to delete Inactive users?

                                                                                                              We want to delete inactive users from our system, but went you deactivate still the names are shown at the inactive section. How to get really rid off these names? Thanks for your response! Fabian van den Barselaar
                                                                                                            • Next Page