Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a File that has orders history that was downloaded from an old e-commerce website I am trying to convert the data to be uploaded onto a new site. It is a csv file so I am working in excel. There are 20 columns of data one of the columns has the Items Ordered (original text string) each row has data from one order. I need to do convert the data from the the original text string so it ends up with only the required fields in the order and format as shown in the converted text string example below.
original text string
Product ID: 1234, Product Qty: 2, Product SKU: Brush, Product Name: Brush, Product Weight: 80.0000, Product Variation Details: , Product Unit Price: 5.00, Product Total Price: 10.00|Product ID: 2345, Product Qty: 5, Product SKU: Comb, Product Name: Comb, Product Weight: 1.3000, Product Variation Details: , Product Unit Price: 1.00, Product Total Price: 5.00
converted text string
product_id:1234|quantity:2|subtotal:5.00|total:10.00|;product_id:2345|quantity:5|subtotal:1.00|total:5.00
below is not a complete solution for you (because currently it is hard to understand from OP what is real outcome should be), but an example which you can adopt to cover your requirements:
Sub test()
Dim S1$, k1, k2
S1 = "Product ID: 35, Product Qty: 2, Product SKU: Brush, Product Name: Brush, Product Weight: 80.0000, Product Variation Details: , Product Unit Price: 5.00, Product Total Price: 10.00|Product ID: 54, Product Qty: 5, Product SKU: Comb, Product Name: Comb, Product Weight: 1.3000, Product Variation Details: , Product Unit Price: 1.00, Product Total Price: 5.00"
For Each k1 In Split(S1, "|")
For Each k2 In Split(k1, ",")
If UCase(k2) Like "*ID*" Or _
UCase(k2) Like "*QTY*" Or _
UCase(k2) Like "*PRICE*" Then
Debug.Print k2
End If
Next k2, k1
End Sub
test:
Related
I have one excel that contains the demand for each part by city:
e.g: the demand for part a for New york is 100 and 1+7=8 for Atlanta
I have another excel containing the inventory level for two warehouses: rural and urban:
e.g: Warehouse "Rural" stocks 50 for part a and warehouse "Urban" stocks zero for part c.
First I joined these two excels with the demand excel being the primary:
I googled about LOD (level of detail) in order to find out the inventory fulfillment for each warehouse by City
-- count the number of unique parts by each city for the demand:
calculated field [a] = { fixed [City]: countd([Part Number demand]) }
-- count the number of parts that are in stock (inventory level>0) by each warehouse:
calculated field [b] = { fixed [City],[Warehouse Location],[Part Number volume]: countd (if [Inventory Level] > 0 then [Part Number demand] end )}
-- calculate the inventory fulfillment %:
calculated field [c] = calculated field [a] / calculated [b]
and I got the following table and I think it is showing the correct fulfillment % by warehouse for each city: e.g: Warehouse "Rural" stocks 33% of unique parts needed by Atlanta.
Question 1: as I include more part numbers into the excel, I only want to consider the top 10 parts by volume needed for each city. I was trying to do the same thing with LOD to first find the total quantity needed per part per city:
{fixed [City], [Part Number demand]: sum([Part Number volume]) }
But it counts the quantity from both excels and I am just wondering if it is possible to only count the quantity from the primary excel (demand not the inventory),
Question 2: once I could count the total quantity needed, how do I transfer it into a filter so that I could only select top 10 parts by demand.
Apologize if these questions are dumb and appreciate for any advice!!
For example, given the data
Name: 1234, Qty: 100
Name: 1234, Qty: 100
Name: 1234, Qty: 100
Name: 1234, Qty: 200
Name: 1234, Qty: 200
The expectation is:
Name: 1234, Qty: 700
The basic idea is that you repeatedly find the name-specific cumulative sum in the hashtable, adding the next value to it. In pseudo-code:
for name, qty in input
hashtable[name] += qty
Depending on your language, you may have to explicitly check whether there's an existing hashtable entry for "name" and create one with the initial "qty" value.
In a HashMap, a key can only be associated with one value, so you will need to use a HashMap<Integer, List<Integer>> or a MultiMap to achieve this.
I have this excel sheet and I want to migrate it to Access (in the near future some other DB manager) And I don't know how to normalize it exactly, I know this might be very opinion base. Currently they use this table for inventory
This is the original Table (sheet)
"TableName: Parts", Fields:"Id_Part", "No_Part", "No_Mold", "No_Lot", "Rev", "Description", "Area", "No_Job", No_Batch,"OrderDate","RecivedDate"
Explanation of problem:
ok the idea is to create a DB that stores all the part numbers the "x" company has, these part numbers have the corresponding field:
1.- Id_Part : is the unique number for each part.
2.- No_Part: Number part of each part that the company uses for there products.
3.- No_Mold: Each Part Number uses a Molding Item, some part numbers use the same Molding Item.
4.- No_Lot: The Lot Number is to keep track of the part numbers in case the client has some issues with the final product. (Its like a tracking number).
5.- Rev: is for Revision control example: A, B or C.
6.- Description: Describes the part number.
7.- Area: name of the department in with the part number is used ( like a type of Part Number).
8.-No_Batch: Its similar to the Lot number, but its an internal number for the company.
9.- Order Date: Date in witch we ordered a part number form a provider.
10.- Received Date: Date when we get that part number from the provider.
This is how I tried to Normalize it
Table1 Name: Parts
Fields: Id_Part, No_Part, Id_Mold, Id_Lot, Id_Rev, Id_Description, Id_Area, Id_job,
Id_Batch, Date_Order, Date_Recived.
Table2 Name: Areas
Fields: Id_Area, Name
Table3: Molds
Fields: Id_Mold, No_Mold, Id_Part
Table4:Jobs
Fields: Id_Job, No_Job
Tablr5:Batchs
Fields: Id_Batch, No_Batch
Table6 Name: descriptions
Fields:Id_Description,Description,Id_Part
Table7 Name:Rev
Fields: Id_Rev,Rev,Id_Part
Any help is useful.
It seems like the PartRevision is the main table here rather than the part. You don't order a Honda Accord, you order a 2013 Honda Accord.
You purchase a PartRevision and it goes into a batch and a lot. You sell a part revision and it pulls from a batch and a lot. Here's how I'd set it up.
I need help indexing this data in solr.
Assume that i have this kind of a students database. I want to index this data in solr and want to be able to search by tested subjects and their percentile. The subjects that the student has taken might differ among students and its not a fixed schema. So, i cant have the subject name as a field name.
I tried exploring dynamic fields but cant seem to be figure out how will i query by the percentile scored.
E.g. i want to filter by all students who have been tested for Math, but only have fared 90 percentil or higher. I also independently want to search by City, name or a combined query between name, address and the tested subjects and their percentil.
{
Name: Max Junior,
Address: Twin peaks
City : ,San francisco,
Grade: 1,
Subjects: ["Math", "Science", "English"]
Tested Subjects:
[
{name: Math, percentile: 95},
{name: Science, percentile: 85}
]
},
{
Name: Alicia Alex,
Address: Nob Hill,
City: San Mateo,
Grade: 1,
Subjects: ["Math", "English", "Craft"]
Tested Subjects:
[
{name: Math, percentile: 65},
{name: Science, percentile: 78}
]
}
Any help is greatly appreciated.
Thanks a lot
I assume you have some unique ID to identify different subjects. For instance Maths subject as 1234, science as 2345. In that case you can index the Math percentile against subject1234_i (assuming percentile in integer value). You can then query for this field as
subject1234_i:[90 TO *]
Refer to Solr query syntax
Other fields like Name, City can be defined as static as those seems common for each student.
In my model I have:
Product <<---> Order
Product Attributes:
productName
productPrice
Product Relationships:
order
Order Attributes:
orderName
salePerson
Order Relationships:
products
Imagine I have a Product (call it product1):
productName: MacBook
productPrice: 1200
The application in general used to sale products.
So after add and done the sale. Automatically create an Order (call it currentOrder) which contain product1.
[currentOrder addProductsObject:product1];
Next I changed product1 price to:
productPrice: 1000
After I recheck the product inside the currentOrder, I'll see the productPrice is UPDATED to: 1000
Which I need to not change and still be exactly like the previous (1200).
Basically I would to do something do NOT update the previous object.
Your business model is not suitable for your case. You need to have another entity 'Sale' or so. Your model should look like: Order <--->>Sale, Product <---> Sale. Product Attributes: productName. Order Attributes: orderName salePerson Order Relationships: sales. Save Attributes: productPrice Sale Relationships: order. So in this way you decouple price from product and will be able store different prices in different orders.