Within my Meteor application, I have accomplished the successful publication of data from the server and its subscription on the client side. Instead of directly displaying raw data on the client's screen, I am interested in performing some calculations on it before rendering the result.
To access Mongo data, I am using the Template.example.helpers block as shown below:
Template.example.helpers({
order: function() {
orders.find({})
}
})
This code snippet allows me to render the data on the client side.
<thead>
<tr>
<th>Order ID</th>
<th>Buyer Name</th>
<th>Date</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
{{#each order}}
<tr>
<td>{{card_details.serialNo}}</td>
<td>{{buyer_details.name}}</td>
<td>{{card_details.time}}</td>
<td>INR {{card_details.amount}}</td>
</tr>
{{/each}}
</tbody>
In addition to this, I would like to perform a calculation where the value of (card_details.amount)/100 is displayed on the client side as
<td>INR {{(card_details.amount)/100}}</td>
. Is my current approach correct? If so, any suggestions on how to implement this successfully would be greatly appreciated. Thank you!