SECTION 02 / 28

Organize customers, shops and bill lists

1 min read

A flat customer–shop–category list can be regrouped hierarchically. At the top choose a customer; inside that customer choose a shop; inside that shop keep categories or item rows. The grouping can match the questions you want to ask.

REAL COURSE DATA · SORT, GROUP AND VERIFY

Customer → shop → bill summaries

Follow the selected procedure. Change a field, tie rule or weekday and explain why the result changes.

Ready

CURRENT RECORD / VALUE

Ready to begin

No records have been processed. Start with Next step.

What we remember

Processed
0

Predict the next change. Keep track of which list level, field and position convention the procedure uses.

Our first hierarchy uses the 30 existing bill summaries: Customer → Store → list of BillNo values. Srivatsan has four bills across SV Stores and Sun General. This preserves a clear path back to each original bill and keeps one customer’s information together.

A list of shop names is different from a list of bill records. A summary’s MajorCategories field is not a complete item-by-item sequence. To analyze purchased item rows, use the original rows as in Week 5’s verified Bill 1 example. Do not expand a summary into invented purchases.

A flat representation and a nested representation can retain different information. Decide whether repeats represent repeated visits, repeated items or distinct categories. Keep identities and counts when they matter; nesting alone does not enforce uniqueness.

Try it yourself

Can one customer’s inner shop list have a different length from another’s?

Show explained answer

Yes. Inner lists need not have equal lengths.

Try it yourself

Does a hierarchy of bill IDs count purchased units?

Show explained answer

No. It counts or stores bills. Quantities require the bill’s item data.

Try it yourself

Why retain BillNo while regrouping?

Show explained answer

It identifies the original bill so omitted fields can be looked up later.

YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑