I have created a user form for adding inventory.
I have 2 combobox in the form
Category = combobox1 (housekeeping, Electricals, Cafetria etc) for these categories I am populating combox1 with rowsource property
Itemsname - combobox2 - I want to populate this combobox based on the category selected in combobox 1
The problem I am facing is the items name repeat if there are more than 1 itemsname then all items name show up in the combobox2 which i dont want. I want to see unique values. I will give you example of entries
ColumnA(Category) ColumnB(itemsname) ColumnC (Vendorname)
Cafeteria Beans Cafe Coffee Day
Housekeeping liquid soap Sevak Industries
IT Monitors Infotech solutions
IT Keyboard Infotech solutions
IT Monitors Raj computers
see screenshot the above columns gets messed up : https://prnt.sc/10cbh30
Now in the above example I populate categories combobox 1 with unique values because number of categories are fixed so I have saved them separately and I pick them with rowsource
The main problem arises when I populate combobox 2 with items name. Same Item can be bought from different vendors so Monitors we are buying from different vendors so there are two entries. In combox 2 I see 2 entries of monitors but I want to see only one since the name is same.
Note I am using for loop and adding items in the loop in combobox 2 so it scans each entries of monitor twice so it adds up monitor twice
Can anyone help on this I am frustrated I cant figure out how to get unique values
Related
video of working spreadhseet
I am building a track and field event lineup and need to search for an athletes name in an array of cells and then return that value to a cell next to the athlete's name. I have a data validation for all of the cells under each specific event and when I select an athlete for an event I want that event name to populate next to that athlete's name under the Events By Athlete table.
For example, If I were to select Athlete A for leg number 2 of of the 4x100, I would want 4x100 to populate next to populate in cell B5.
I have tried LOOKUP functions, excelformulabot, and match functions but have come up empty.
Remove all merged cells from the sheet (recommended but not 100% necessary in your case)
Where you need the "beauty" of the merged cells, use "center across selection"
Make a new column for every event for example on the left and write for each player the name of the event (write 4 times 4x400m). This will make it much easier later.
4)These columns you can hide later on, when everything works
If you have office 365, then use VSTACK function to put all the names of all small tables on top of each other, same with the event names in the new column
If you don't have VSTACK you can do referencing manually into a new column somewhere in you workbook.
Use the Index and Filter function so search for the event in the VSTACK.
First the VSTACK list gets filtered for the Athlete, then with the Index function the Event Number gets picket out. For that it is important that the events take place exact in that order as you put it in the VSTACK.
I came here today with a theoretical question. (hint: it will be long and tough, but to fully understand the problem I think I have to write every important detail. If you read it to the end huge thanks for you, you're not the hero we deserved but the hero we needed)
Story time: I'm currently building an online shop from 0. It has the same principles as an ebay: users can create advertisment for their used products. The problem is that I want to create a filtering feautre.
What is my MongoDB data structure?
My page has products with different attributes, by this I mean that the products have varying categories and values. To imagine here is an example
Product A:
Creator:User1
Category:Car
Type:BMW
Color:Red
Product B:
Creator:UserB
Category:Electronics
Type:Phone
Producer:Apple
To be more complex each user can define maximum 3 more extra category and value for each product. So for example User1 adds 2 new category and the final product will be:
Product A:
Creator:User1
Category:Car
Type:BMW
Color:Red
Number of seats:4
Fuel type: Gasoline
Because of the above mentioned when a user adds a new product there will be two type of categories: the static ones which are predefined by me(Category,Type,Color -> in car's case) and the dynamic ones which the user adds (Number of seats, Fuel Type or anything else).
Overall: My final data structure in mongoDB is not static, since there are some added categories. Because of this I have a Product collection and each document looks like the above mentioned example
How are the items shown?
I have a main page. When I populate it I make a call with $skip and a $limit attribute set to 8, so for the first time I only query 8 products. If a user clicks on a Load More button it will load another 8 product and so on.
FINALLY: My actual question ...
So at this point I guess you understand everything related to the business logic so it's time for my question: if I want to filter these dynamic products, but i don't know what is the best practice for it?
My idea:
First create a mongoDB collection named Categories. Each main category will be a document in it and we will store static and dynamic categories and values
ex:
category:car
predefined:[{type:[BMW,Mustang,Ferrari]},{color:[red,green,blue]}]
userdefiend:[{number of seats:[2,4,5,6]},{fuel type:[Gasoline,Air,Diesel]}]
We load the the values in the main page if a user clicks a specific value ex:BMW we set a limit to 8 and go through on our Product collection and get the 8 items which has a Type:BMW. If he selects another option ex: color:Red we loop again through the collection but now with two criteria: Type:BMW and color:Red.
Idea2: Create a Category collection again with this structure
categoryType:predefined
mainCategory:Car
categoryName:Type
BMW:[prodA, prodC,prodD]
Ferrari:[prodD,prodE]
...values:products which contains
categoryType:userdefined
mainCategory:Car
categoryName:Number of seats
4:[prodA, prodD],
5:[prodE]
If a user selects from Type category the BMW we load the products from the BMW fields [prodA,prodC,prodD]. If the user selects Number of seat category with a value 4 we load the [prodA, prodD] and on the webpage we use a filter with our actual products so it remains only [prodA,prodD]. And from our actual list we use findById for the specific products.
I think that these are not the best options from any perspective, but I am really confused.
What do you guys think how should I structure my categories/products to have an efficent read/write/update complexity?
Anyways thank you for reading this and if you made it until here I'm curious about your idea. Have a nice day
UPDATE:
The filtering functionality
To don't have any confusion this is my filtering idea: When a user selects a main category for example Car or Electronics I want to show only the relevant filtering categories and options. Filtering categories in Car's case are Type and Color.
I want these filtering options to have pre-poupulated options. By this I mean, that if a filtering category is Type, and there are 2 Products which has Type:BMW and Type:Ferrari I want to show these values as options for filtering. And I don't want to hardcode these options, for example I hardcoded Type:Laborghini and I have no products with type Laborghini.
By the end if a user clicks to a Type:BMW I will filter all of my products based on that criteria.
My filtering side menu will look like this:
Type: BMW,Ferrari (these values exists in my database)
Color:Red,Black,Grey,Yellow
And for user-added categories I will build a searchbar, if a user selects a userdefiened category I want to add to the filtering categories so the overall look would look like this:
Type: BMW,Ferrari (these values exists in my database)
Color:Red,Black,Grey,Yellow
Number of seats:4,6,7 (number of seats category is added by user, 4,6,7 are the existing values to this category)
You could structure Your data like having a generic Products collection. Having both
Product A:
Creator:User1
Category:Car
Type:BMW
Color:Red
Product B:
Creator:UserB
Category:Electronics
Type:Phone
Producer:Apple
rows. Whenever you show the filter component, you can select the available categories by using an Aggregate (https://stackoverflow.com/a/43570730/1859959)
This would generate search boxes like "Creator", "Category", "Type", "Color", "Producer".
The data itself would be as generic as possible.
When the user wants to add a new product, it starts out from a template, like "Car" or "Electronics". The Templates collection gives him the initial values, which should be included. So it would be like:
{Car: [{type:[BMW,Mustang,Ferrari]},{color:[red,green,blue]}],
Electronics: ... }
Selecting a Car would generate the "type" and "color" input boxes. Saving the form would insert the new row into Products.
I have four ComboBoxes that are linked to SQL Tables and then they are linked to a log table.
The problem I have is that the combobox is displaying the correct options but only logging the ID value.
So say I have a combobox called Location and it has 3 locations:
Cape Town
Dallas
London
The ComboBox is showing those 3 choices in the drop down but when the choice is logged it will only return the values 1,2 or 3 and not the cities
Here is the row source:
SELECT Location.ID, Location.Location FROM Location ORDER BY Location.ID, Location.Location;
But when I tried swapping the Location and ID order around it then displays the values and then logs the cities.
Also this is only an issue since I linked the tables to SQL when they were local tables it worked fine.
I must be missing some sort of search field in the source query, can anyone help me please
Thanks
Dan
I managed to solve it, I had to take ID out of the equation completely and then add into extra location columns in my row source
It ended up like this:
SELECT Location.Location, Location.Location, Location.Location FROM Location ORDER BY Location.Location;
To be honest, I stumbled across this and it works. So that will do for me!
I have an Access table that has about 500,000 records. I want to trim down the results as I type text into the ComboBox. Basically, I need a dynamic ComboBox that displays records based on each character as I type into the ComboBox.
The problem is, the underlying table for the ComboBox has about 500,000 records.
And the ComboBox object can only display 65,000 records before it reaches it's limit, and won't preview the rest of the records. Nobody looks at 65,000 records at the same time but when any number in the middle of the entire record set is typed, the records won't display at all. Because that particular number is beyond the 65,000 limit. So i need a dynamic combobox for the whole table.
For example, if you are looking at a bunch of SSNs, instead of ComboBox displaying all the records which it can't because too many SSNs (more than 65,000 which is ComboBox limit) this is what I need.
If you type 5 in the ComboBox. The list would only display the 5-series of numbers. If you type 51 it limits the list values are the 51-series of numbers.
If you type 512 it limits the list values to the 512-series of numbers and so on. FOR THE WHOLE TABLE THOUGH, not just the first 65K.
WHAT I HAVE TRIED SO FAR is implementing a second unbound text box, however, this makes querying a two step process. I am wondering if I can just do it all together.
David W Fenton already provided a fairly detailed answer to this problem here. The gist:
The simplest approach is to assign the combo box's Rowsource only after you type some characters in it. You'd do that in the combo box's OnChange event
Allen Browne's Combos with Tens of Thousands of Records has some other bells and whistles (abstracting the logic into a function, preventing recalculation of the RowSource if the value hasn't changed), but the basic idea is the same:
Leave the combo's RowSource property blank.
Create a function that assigns the RowSource after a minimum number of characters has been typed. Only entries matching these initial characters are loaded, so the combo's RowSource never contains more than a few hundred records.
Call this function in the combo's Change event, and the form's Current event.
If you really want to successively filter the RowSource as each character is typed, you could adapt these answers to do that. For example, you could change the test condition in the David W Fenton solution to If Len(Me!cmbMyCombo.Text) >= 1. For the Allen Browne solution, you could set the constant to 1 and change the line that sets sNewStub to: sNewStub = Nz(sSuburb, "").
However, until your RowSource query is returning a chunk of numbers that is less than the row limit, you're not going to see any benefit. This is why both solutions linked above begin filtering after 2 (or 3 or 4) initial characters have been typed.
Is there a way by which I can programmatically update a select options list of LineItems?
I am trying to create Line Items from data provided by site administrators.
If you refer to http://178.79.128.76/coronet/node/78, you will see 4 types of data: The Viewing date, The Viewing options, Add to cart button and Show Times.
The Show Times data is unique for each product. Each entry consists of a date and one or more time(s).
The Viewing Options is a line item and I am trying to populate it with data extracted from the Show Times field in the following format:
Viewing Date 1 + ShowTime 1
Viewing Date 1 + ShowTime 2
Viewing Date 2 + ShowTime 1
Just for demonstrating my objective, I populated the example data above in my Viewing Options Line Item using hook_form_alter - they don't actually work when you select and attempt to add the product to.
You can have your tables set up with LineItem table, a ViewDate table and a ShowTimes table. That will allow you to have a ViewDate collection with a foreign key to the LineItem, and a ShowTimes collection with a foreign key to the ViewDate.