HI,
I am new to Corvid but I managed to do couple of things with the help of people like you all. Now that I have a repeater and that is connected to a dataset and I can see the data in my collection when I Preview the site. However, the problem is that some items in my database are repeated and repeater shows them one by one. I do not want same items repeated in the Repeater.
Say I have stock of motor (of various types) and the price of each motor are different. I do not want repeater to show Motor $10, Motor $15. Instead, I want to repeater to show Motor $35.
Please note that here the item ‘motor’ repeats in my database, only the item description (like, motor 10 kw or 15 kw) and price are different. Likewise there are many other item, Compressor, Compressor also repeats but it’s description and price are different. I want repeater to show Motor (and the total amount of motors) then Compressor (and the total amount of compressors)
I hope my question is clear.
Thank you.
Edit: I have connected each elements in the repeater through a dataset to populate database items, I have not used any code for this purpose.
You will need code to accomplish what you want. You can use the WixDataQuery.distinct() API in your query to avoid duplicates. See the Example: Remove duplicates from connected dropdown options using distinct() query as one example of how it’s done.
Thanks for your reply, I went through the links you have provided. As a beginner, I understand that code but I won’t be able to tweak the code to match my requirement.
My requirement is not only to find the distinct items from the database and show in the repeater, but, I also want to sum the price column of the each item.
As I mentioned in my question, Motor, Compressor, etc will repeat in my itemName column and price of each motor maybe different. Hence, in the repeater, the item Motor will appear only once and the Amount of motor will be the sum of the prices of all the motors. Likewise for all other items, Compressor, Fan etc.
I hope my question is clear.
Thanks for your time.
Edit: Kindly note that there is no search or dropdown on my page. The repeater to show the values when someone navigate to the page.
Thank you so much for your input.
Part-1
On my page I have dropdwons that needs to be populated with distinct values and I managed to do this with other codes I found online, but, I replaced those codes with the one that you provided as this is lesser and clearer code than the other.
Part-2
I created this post for another purpose which I am still not able to do. However, I could filter my dataset using code now, which I did earlier without code.
What I want is sum up the price column and show in the repeater as I mentioned in my question .