Converting Number Fields to Currency within a repeater

Hello again, I have another issue I am trying to figure out. How to display data from a number field as currency within a repeater.

Currently, I have the data set as text in the collection, ie " $15,995 " which displays perfectly fine. The issue arises when a sort function is added, ie “Sort by Price (low to high)” as it sorts alphabetically not numerically causing $16,999 to display before (lower) than $5,995

To fix the sorting issue I returned to entering the data as a numerical value. The problem now exists with how the data displays, I need it to appear as $5,995 not 5995.

How do I format the data to add a dollar sign ($) and a comma in the appropriate place? None of my items will contain anything cents, so no need for any decimal points.

My dataset is called “NEWinventoryDataset” and the field containing the price is called “ourPrice”, and this all connects to “repeaterInventory”.

The page us currently sitting on a testing URL https://www.401test.com/new-rvs
Any help would be appreciated!

Same issue. Any advise would be grately appreciated

You will need an onItemReady() function or a forEachItem() function. You can then format your currency value and set the value of the item’s text field that is used to display the currency.

Keep in mind that you will need to make sure you have a properly defined Selector Scope for the Repeated Items . This ensures that the components for each item are properly referenced.

Hi Yisrael,

I appreciate your response and after 48 hours of diligent reading feel as though I am still totally lost.
Could I perhaps ask you to provide an example code that may work.

Please and thank you

Here’s an example that uses a Repeater:

Search a Database
Add search functionality to your site by adding input elements to the page and then adding code to enable a search.

This should help you get started using Repeaters.