Excel - extracting values from data table for list validation - vba

Background:
I have a workbook/tool that performs exactly as I wish.
The tool includes two main components:
A list of ingredients grouped by category (i.e., dairy, produce, etc.)
a sheet with recipe tables
On the ingredient sheet, all ingredients of a specific category are grouped together as part of a named range (i.e. "dairy_list").
[Named Rage: Dairy_list]
[Ingredient] [Unit] [Price]
Milk, 2% 1 litre $2.50
Milk, Whole 1 litre $3.50
[/Named Rage: Dairy_list]
[Named Rage: Fruit_list]
[Ingredient] [Unit] [Price]
Apples pound $0.99
Bananas pound $1.99
[/Named Rage: Fruit_list]
Recipe tables include a row for each ingredient (note: there may be hundreds of ingredient rows once the model is complete). In each row are two columns, from the first contains a list validated drop down menu containing the names of all categories, the second is a list validated drop down containing all ingredients that reside in the selected category. I do this using the named ranges and the INDIRECT([category cell]&"_list") function for the list validation. So if the category "Dairy" were selected, the validation list would be the range "Dairy_list".
This works; however, some challenges exist from a usability stand point.
Challenges:
The users of this tool are not experienced with Excel. Users must be able to easily add rows to each category and add categories to the model.
Explaining how to define a named range, insert rows within a range and ensuring ranges' naming conventions are valid are all relatively simple tasks for experienced users but not for many of the intended users of the tool.
Users also may wish to sort the ingredient list in different ways (using auto filter), which is not possible when the table is divided into subgroups and categories.
I am rebuilding the model template to allow for this usability and to simplify the user experience.
Objective:
The format of the ingredient data table will be single, sortable table:
[Category] [Ingredient]
Fruit Apple
Fruit Banana
Vegetable Carrot
Fruit Melon
A named range of possible categories will be contained on a separate sheet.
Ideally, the user need only add a category to the category list or add an ingredietn to the ingrdient list, with no further steps required other than to populate recipes.
The user should be able to add (within reason) as many categories as they want. Similarly, on the ingredient sheet, the user may add (within reason) as many ingredients for each category and in any order they wish. This is important because the solutions I have found on this site and others for dynamic validation lists typically involve creating an additional list/named range that groups list items by category then applies a named range to each list.
[Fruit] [Vegetables]
Apple Carrot
Banana
Melon
This approach, while functionally relevant, is essentially a less elegant version (the data must reside in multiple locations) of what my current model uses and one which I am trying to avoid (I want to avoid as many steps as possible for the user).
What I wish the model to do in the recipe tables is, wherever the category cell contains [Fruit] the ingredient cell only lists items from the ingredient list where the [category] is Fruit. But not require the data to be manually extracted or grouped within the ingredient list.
I've experimented with VBA auto-filtering, but I do not want to alter the filter, format or ordering settings on the ingredient list if the user has sorted a certain way for usability.
If I were constructing this in another programming language that referenced a database, the equivalent functionality would be a SQL statement like "SELECT [ingredient] FROM [Ingredient_List] WHERE [Category] = 'Fruit'".
I am open to VBA or non-VBA solutions (preferably ones that are relatively backward compatible as I do not have control over Excel version).
Thank you in advance for any thoughts/direction/resources/solutions.

Related

Shopware API search products endpoint total from a stream inconsistent

I have two dynamic product groups
First: Test Product with variants
Conditions: Product Is equal to Variant product
Result total 7 like I expect this
Second: Active Products
Conditions: Active yes
we allready see that the stream ids are just set to 5 products
Now we get a total of 5 instead of 15 products like expected?
Why is it inconsistent, and how can I modify my request to consider also the variants?
You shouldn't rely on the stream_ids column as an indicator which product is shown in a dynamic product group at any given moment. This is because there are multiple more things that factor into whether a product is shown to a user in a dynamic product group.
The filters you define for the group resolve to an SQL query, which in simplified terms would yield something like WHERE active = 1 AND id IN ('...', '...'). So the stream_ids column isn't used to select the contents of a group, but the entire query including all filters is executed in the storefront request. The result of that query is what you see in the preview of the dynamic product group.
Why doesn't it correlate completely with the content of stream_ids?
Shopware features inheritance of fields. If fields of a variant haven't been assigned a value, they may inherit that value from their parents. This may not be reflected in the contents of stream_ids. In fact the children/variants may even inherit the contents of stream_ids.
Then there's the fact that contents of the product group may vary, depending on the current sales channel. That may be because the sales channel features a different language, hence the content of a translatable field used in a filter may vary. Also if you use price filters, there is the possibility of products with multiple prices, which might only be shown if certain conditions are met, defined by the rule builder.
In short, don't count on the stream_ids, which can't reflect all these variables but are used in some capacity internally, for invalidating caches and such. Instead use the preview to judge what the average user might find when they see a product group. There's also the possibility to choose which sales channel the preview should apply to, for the exact reason, that contents may differ depending on the sales channel.

How do i continue this database? (linking characteristics with predefined values to categories)

I'm struggling to understand how i need to do this. So my problem: I'm supposed to allow someone to sell a product on a website. Before selling, he has to chose a certain category. Each category has different characteristics that could be marked, and those characteristics are entirely dependent on the chosen category. The values of those characteristics are predefined, and are already put in the database.
My question now is how do i go on about this? How do i link those characteristics to the chosen category, and how do i link the different amounts of predefined values to those specific characteristics?
example:
category: keyboard
characteristics: condition (dropdown), keyboard layout(dropdown), extra options(multiple choice)
condition has 3 options: new, as good as new, used
keyboard layout has 2 options: qwerty, azerty
extra options is multiple choice, has 3 options: gaming keyboard, wireless, 60%
second example:
category: laptop
characteristics: condition (dropdown), refresh rate(dropdown)
condition has 3 options: new, as good as new, used
refresh rate has 5 options: 50hz, 60hz, 120hz, 144hz, 240hz
Now i would have to make this work in my database, but i can't even figure it out on a relational database diagram.
Any form of help would certainly be appreciated!
I would distribute fields like this:
CATEGORIES (keyboard, laptop)
id
name
ATTRIBUTES (refresh_rate, layout)
id
name
FEATURES (50hz, 60hz, qwerty, etc)
id
attribute_id
name
CATEGORIES_ATTRIBUTES
id
category_id
attribute_id
PRODUCTS
id
name
category_id
condition (could be an enum, I put it here as every product has a condition)
PRODUCT_FEATURES
product_id
attribute_id (redundant but it can save you a join when making queries)
feature_id
Cheers!

Most appropriate way to store/retrieve User Input in a eCommerce iOS application?

I'm a bit confused with Sqlite, Core Data, NSUserDefaultsand PropertyList. I know what is what, but not a very clear idea of about where to appropriately use them.
I know that there are lots of tutorials, but I'm good at learning through situation based understanding. So kindly do help me to understand this in the situation that I'm facing right now and to make use of the available options wisely.
I'm working on an ECommerce iOS (native) application, where I'm highly dependent on API's for data display. Now I'm in need of recording user's review for a product and send it over through an API.
ie. I have three components, rating title, rating value(for that title) and another rating title ID. I'm defining with an example, I need to store multiple rows with details,
Components Data to be stored
**Title** - Quality | Value | Price
| |
**Rating** - 2 | 3 | 1
| |
**TitleID** - 10 | 11 | 12
Like this, there will be so many entries, i.e, the number of components differs for various users, for some users, there might be more than three components, which must be saved & send through an API. So how should I save these data? which is the RIGHT way to save these data temporarily?
If I understand you correctly, as vaibhav implied your question seems pretty general and probably relates more to structuring your data to fit your requirements than to technical aspects of the iOS / CoreData environment. In that vein, I’ll offer a few thoughts I’d have in structuring a data structure for quality ratings per your description.
If your ratings will always be for the three categories you show, i.e. Quality, Value and Price, I wouldn’t over-complicate things; I’d just use three properties in a rating record to hold the values that a user assigns in his/her rating of a product (just showing selected attributes and relationships in all following lists):
Product
name
Rating
ratedProduct (many to one)
qualityRating Int
valueRating Int
priceRating Int
Done this way you’d need to associate the values with their types in code for the APIs, such as (where item is a retrieved rating record):
display(product: item.ratedProduct.name, quality: item.qualityRating, value: item.valueRating, price: item.priceRating).
On the other hand, you may be describing a more generic approach that would allow for ratings categories that vary more frequently, or perhaps vary among products. This could apply where, for example, ratings include how well things fit for clothing but not for other products like books. In that case, you’d need a more complicated structure where a product could have a variable number of ratings of different types, so you’d need another layer of entities that let you create an arbitrary number of rating records that applied to a product.
Here you'd create a separate rating record for each rating that a user assigned to a product.
The simplest form of that structure would be like the following:
Product
name String
UserEvaluation
ratedProduct (many to one)
productRating (one to many)
ProductRating
ratingType (many to one)
value Int
RatingType
ratingTitle String
ratingID String or Int
Then you’d have to have a bit more structure where you'd list the product and then access the ratings with a loop that cycled through the set of all of the ratings linked to the product record somewhat like this (where item is a retrieved UserEvaluation):
displayTitle(product: item.ratedProduct.name)
for rating in item.productRating {
displayRating(ratingTitle: item.productRating.ratingType.title, ratingValue: item.productRating.value)
}
You'd probably want to combine these into a method that takes the name and an array of ratings.
To keep track of things, you’d also probably want to create another entity that defined product classes and specified what specialized ratings applied to each class (like fit for clothing and mileage for cars). By default, you also may want to allow for a few generic rating types that apply to all products (like the quality and price ratings you show). For this approach, the full structure would look like this:
Product Category
title
ratingType (many to many)
Product
productType (many to one)
UserEvaluation
ratedProduct (many to one)
productRating (one to many)
ProductRating
ratingType (many to one)
value Int
RatingType
ratingTitle String
ratingID String or Int
With this structure, once a product is assigned a productType, the application would know what ratings to ask for in the UI.
You could try building more complicated rating records with all of the types that apply to a product category, but that would get very messy if the applicable categories vary over time. You could also create a "custom" rating type that let a user specify a title and input a rating, in which case you'd need a text field in the rating record that only applies if the ratingType is "custom".
I hope this helps…

Searching through data with multiple conditions VBA/Excel

I have a list of data with columns indicating the test a product went under and the product. Each product undergoes several tests for example (hot medium cold). If you can imagine, the data for a specific product may look like
A B
hot product1
medium product1
cold product1
I have many products that under went testing so the spreadsheet is extensive (A400 = cold, B400 = productX). What I am trying to do is see if each product underwent the hot medium and cold testing. I made an additional column to eliminate repeated product listing and search the spreadsheet and find the tests (no success). The end goal is to create an additional column with all the parts that did not go through all of the testing.
Make four new columns with these formulas
C: COUNTIFS(B:B,$A1,A:A,"hot")
D: COUNTIFS(B:B,$A1,A:A,"medium")
E: COUNTIFS(B:B,$A1,A:A,"cold")
These will show you how many times each of those products has been tested in the respective category. Then, use this in the last column:
F: IF(AND($C1>0,$D1>0,$E1>0,"",$B1)
This will account for items that were tested in a more than once. If it had a category it was not tested in, it will show you that product name. There might be multiple values in this column.
EDIT: If you absolutely had to have only one column, you could easily combine these together into a superformula.

How do I make a shopping list from multiple recipes in an SQL database?

I'm working on using a recipe database in SQLw, like the one in this question (which has helped a lot already) Structuring a recipe database , to combine the ingredients of several user selected recipes to a shopping list.
Also, the items on this shopping list are to be divided in two categories (eg: "groceries" and "check pantry")
Example case:
User can select 7 recipes to make a weekly mealplan in a form (almost got this part)
The given output is a shopping list of all the ingredients marked as "groceries" and a "check stock" list of all the ingredients marked as "pantry".
Any help at all would be much appreciated!
I had just posted a full solution, but given the subject here looks like it may be homework, I'm just going to point you in the right direction. If this isn't homework, leave a comment and I'll put the full solution back.
Since you have multiple recipes, a normal selection based on joins would give you back multiple rows per ingredient. You want some way to roll up all of the rows for a given ingredient into a single row and show a total of the quantity that you need.