I want to search for certain Product-IDs within each Customer-ID. Based on which Product-IDs (only A or only B or the combination of A&B etc.) the customer has bought, the customer should get a certain calssification (Basket-Code).
Could please somebody help me? Are there any nodes made for such classifications?
Hi @peter_b and welcome to the KNIME community forum,
Do you want to label the customers based on if they have bought product A, or B or both?
Is that right?
You can filter the rows based on these products (optional) and then use a GroupBy node to concatenate the products for each unique customer and finally check the conditions in a Rule Engine node by applying the “? MATCHES ?” function.
Here is an example:
label_customers.knwf (21.1 KB)
Or am I missing something?
thank you for your fast reply! Yes, that’s alsmost what i need:)
And yes, it should be always a different Type, BUT independent of the order of the letters.
A => Type-1
B => Type-2
A&B => Type-3
B&A => Type-3
AND: To Add the “Type-X” as a column to the origin table for each Customer-ID, i would use a “Join” node with an inner-join on Customer ID, right?
Change the expression in the Rule Engine node to this:
$Concatenate(PID)$ MATCHES "(.*a.*)(.*b.*)|(.*b.*)(.*a.*)" => "Type-3"
$Concatenate(PID)$ MATCHES ".*b.*" => "Type-2"
$Concatenate(PID)$ MATCHES ".*a.*" => "Type-1"
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.