You query an e-commerce API for the purchase history of many products. The results are one feature per product, with a list attribute containing an entry for each purchase. How would you get an attribute summarizing the number of purchases per product?

Prepare for the FME Certified Professional Exam. Study with flashcards and multiple-choice questions; each question includes hints and explanations. Ensure your success!

Multiple Choice

You query an e-commerce API for the purchase history of many products. The results are one feature per product, with a list attribute containing an entry for each purchase. How would you get an attribute summarizing the number of purchases per product?

Explanation:
Counting items in a list attribute is the key idea. To summarize how many purchases exist for each product, you need to know how many entries are in the purchases list for that product. The ListElementCounter transformer exactly does this: it counts the elements in a specified list attribute and writes the result as a new numeric attribute. This gives you a per-product purchase count, even when some products have different numbers of purchases. If the list is empty or null, the count will reflect that appropriately (typically zero or null, depending on settings). The other transformers don’t provide a simple count: ListBuilder creates a list, ListSearcher looks for a specific element in a list, and ListDuplicateRemover eliminates duplicate values.

Counting items in a list attribute is the key idea. To summarize how many purchases exist for each product, you need to know how many entries are in the purchases list for that product. The ListElementCounter transformer exactly does this: it counts the elements in a specified list attribute and writes the result as a new numeric attribute. This gives you a per-product purchase count, even when some products have different numbers of purchases. If the list is empty or null, the count will reflect that appropriately (typically zero or null, depending on settings). The other transformers don’t provide a simple count: ListBuilder creates a list, ListSearcher looks for a specific element in a list, and ListDuplicateRemover eliminates duplicate values.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy