N
Novu8mo ago
istiak

how do I perform substraction in email template ?

I want to show follower information like with first 3 users name , avatar and followed by X other users . lets say I have the total number of followers by step.total_count , now how to I get the value of X in email template , i can not find anyway to substract step.total_count - 3 .
5 Replies
Ask Inkeep
Ask Inkeep8mo ago
Hi @istiak, I'm an AI assistant for Novu. While a team member reviews this question, I'll see if I can find relevant sources for your question. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Handlebars & Helpers * Email * Step Conditions * Get in-app notification feed for a particular subscriber -----------------------------
Ask Inkeep
Ask Inkeep8mo ago
Answer Currently, Novu's Handlebars templates do not support direct arithmetic operations like subtraction within the template itself (1) . For scenarios requiring subtraction or other arithmetic operations directly in the email template, you might need to perform these calculations outside of the template and pass the result as a part of the payload to the template. For displaying information like the first 3 users' names and avatars followed by "X other users," you would need to calculate the value of "X" (e.g., step.total_count - 3) in your application logic before triggering the notification. Then, you can include this calculated value in the notification payload. For example, if your payload includes a property for the calculated value, such as others_count, you would use it in your template as {{others_count}}. If you're looking to iterate over the first few elements of an array (e.g., displaying the first 3 users), you might find iterating constructs like {{#each}} useful, although the direct subtraction for displaying "X other users" would still need to be pre-calculated. For further enhancement or feature requests, considering Novu's active development and community-driven enhancements, you might consider contributing to the discussion on their GitHub or community channels (2) (3) .
istiak
istiakOP8mo ago
the step.total_count comes from digest , so how can i access this in application logic
Ask Inkeep
Ask Inkeep8mo ago
Got it. Tagging @Support for additional help.
Want results from more Discord servers?
Add your server