Cancel
Showing results for 
Search instead for 
Did you mean: 

Create a summarized (with quantity) roll-up list with minimal code

Pioneer
Pioneer
If you have ever wanted to create a roll-up summary of parts that have the same value (or set of values), you can do it with 4 quick steps but with simple lines of code. Here's how:
 
1) Create a property (say "Rollup1") on the partfamily that you want to roll-up...this property should basically return a string that is made of values of other properties that make it a unique part. For e.g. PartNum="12345",Style="B",Manufacturer="ABC Corp"

2) Create a new subpart collection with a new valid partfamily (say PFRollUp). Its quantity formula should look like the following:

 Result = UniquePartsQuantity(Rootpart.Subparts("ComponentParts"), "Rollup1")
 
 The first argument can be a subpart collection (or a connection) or a single part). It will traverse the branch from that point on. Second argument is simply the name of the property that has the roll-up criteria

3) Create a property (say RolledUpValue) with formula like:

 Result = UniquePartValue("Rollup1", SubpartId)

 and another property (say quantity) with formula like:

 Result = UniquePartQuantity("Rollup1", Me) --> this returns how many unique parts of this type were found

4) Create properties that would extract their values from the 'RolledUpValue' property.
 
For e.g. in this case, we would create a property named 'Style' that would parse the value of the 'RolledUpValue' property (which looks like PartNum="12345",Style="B",Manufacturer="ABC Corp") using string manipulation
 
Theoritically, the rolled up string value could be an XML string for easy manipulation instead of a comma-delimited key-value pairs.
 
Regards,
Dharmesh Sanghavi