Dropdown choices update text (but not the same value)

I’ve got a database of stores with product prices and I’d like to allow a user to use a dropdown menu to present only 2 of the products to display information on (there are many products). Then in a separate text on the page (or part of a table does not matter) make a sum calculation of all the displayed product prices for each store. I’ve included a picture below of theoretically what it would look like in Excel. I’m not too picky if the data is displayed horizontally or vertically.

I’ve tried exploring this via a table that filters via dropdown selection but can’t figure out how to implement summing only present cells on the page, so I’ve thought of just adding multiple separate ‘text’ boxes on the page and having these text boxes update (linked to the collection) based on dropdown selection,

For example, a user on dropdown 1 chooses Apples and dropdown 2 chooses corn and therefore only the apples/corn info would display like the below.

My question would be how do I have a text box connect to a database location that is dependent on a dropdown choice, but the dropdown choice text does not equal the text box result. I.e Apples chosen on dropdown 1 and then text box displays 7.28 infront of storeA.

If anyone has a better approach I’m all ears, perhaps it would be easier with repeaters?

Of course your choice should be a —> REPEATER.
-REPEATERS are DYNAMIC-ELEMENTS
-REPEATERS can be loaded MANUALLY, or AUTOMATICALY FROM DB

Are you trying to create a → GROCERY-LIST ???

If so, i even wouldn’t use DropDowns as MENU, instead also using a futher → REPEATER, which loads all STORE-ITEMS directly from your DATABASE.
Every of these ITEMS inside REPEATER has a CHECKBOX, which could be checked to add the activated ITEM into a → GROCERY-LST.

This way your user can simple generate a GROCERY-LIST.

After SUBMISSION, a second REPEATER will shown all SELECTED ITEMS ONLY.

I am trying to make a grocery list! That’s interesting, I didn’t really consider repeaters! Let me look into this! The problem I see with
“instead also using a futher → REPEATER, which loads all STORE-ITEMS directly from your DATABASE.”

Is that I currently have like 70 products at each store and this number will be growing. So having a dropdown seems slightly more ideal (most ideally would be a input search where you can search a product and select it but this seems far-fetched right now)

It will depend on how you want to present your items !?

You can have just one store, you can also have 100-stores.

The question is, how you want to present your USER all the items?

  1. Do you want to present them sepparatelly?

That means, for example you have 50-Stores and you give your user first the option to choose, from which STRORE the user wants to see PRODUCTS?
(50-different-DATABASES in the BACKGROUND) ??? Is that an ideal solution?

  1. May be you want show the user just the ITEMS (categorized by ITEM-TYPES) no matter from which DATABASE the ITEMS come from?
    All ITEMS shown in one big REPEATER-LIST which can be scrolled as INFINITE SCROLL-LIST. Items loading from either one big database, or several separated ones, but loaded in just one big list.

If i would be the user, i would prefer a menu where i don’t care from which store a product comes from, i just would search for CATEGORY (SHOES, T-SHIRTS, CARS, SOFTWARE, WHATEVER) and would expect to see exactly just the items of my choosen category.

The same way a glocery-list should work.
The user don’t care about where the item comes from.
He just wanna see his generated LIST and the SUM-PRICE (END-PRICE) on the very bottom of his created list, to know how much to pay for all selected ITEMS.

I would use DROPDOWNS ONLY TO CATEGORIZE all ITEMS, but showing them in an REPEATER with CHECK-BOX-OPTIONS to select them.

The Dropdowns would only do the JOB of a FILTERING-ENGINE.

  • User selest a category from dropdown —> REPEATER offers all related options to make your choices.
    -User selects a second category from second dropdown → REPEATER loads additional ITEMS and shows them aswell.

You also could even give your REPEATER some special functions like…

-different-view-options (sepparated CATEGORY-VIEWS / ALL-CATEGORY-VIEW)
and some other special FEATURES and FUNCTIONS.

But this will depend on your own imaginations and creativity.

You can generate everything with CODE if you want.

Ya the current plan is to only have the user choose products, not products and stores just like you mentioned.

Essentially users chooses product for column A and a product for Column B. Then all stores prices are shown for those two chosen products.

Seems like I will have a few areas to tackle with all these linking and options. Will try to chop it up and see what tutorials may help me with it.

Start your coding-adventure here…

https://www.wix.com/velo/forum/coding-with-velo/create-cascading-form-to-search-state-city?origin=notification

This will show you, how to work with DROPDOWNS a more professional way.
Combining this knowledge with REPEATER and CHECKBOXES + some usage of Wix-DATA-API —> ET-VOILA!!! → you have generated a cool DYNAMIC-GROCERY-LIST directly fired from your DATABASE without any DATASET-USAGE.

YES → A LOT OF CODE → BUT → A LOT OF ADVANTAGES !

I’ve been exploring above and have tried to start summing some example text, however, the output seems to be incorrect. I think I’m having trouble converting text to numbers and summing those. I have the below code but below result

export function dropdownfilter_change ( event ) {
$w ( ‘#text46’ ). text = String ( Number ( $w ( ‘#text45’ ). text ) + Number ( $w ( ‘#text14’ ). text ));
}

2.07 =#text45 2.4=#text14
but when trying to sum the text converted to numbers I get the value 2?