Persist and Reapply Filter Presets
The dispatchers on your project set up the same customer list every morning — sorted by name, narrowed to their own slice of customers — and lose all of it the moment the session ends. You are building the persistence layer for named filter presets: capture a record's entire view (its sorting and all its filters) as one text string, store it under a code, and reapply it on demand. And because stored presets outlive code changes, a preset can go stale — a view naming a field that no longer exists, or text that got mangled — and your manager must detect that cleanly instead of crashing with a raw parser error.
Requirements
Pick object IDs in the range 50100–50199, and reference other objects by name, never by ID.
Create a table named "Filter Preset" with exactly these fields:
"Code"of typeCode[20]— the primary key."View Text"of typeText[2048].
Create a codeunit named "Filter Preset Mgt." with three public procedures:
procedure SavePreset(PresetCode: Code[20]; var Customer: Record Customer)
procedure ApplyPreset(PresetCode: Code[20]; var Customer: Record Customer)
procedure IsValidView(ViewText: Text): BooleanRules:
SavePresetcaptures the current view ofCustomer— the sort key, the sort direction, and every filter — and stores it in the"Filter Preset"table underPresetCode. Store the text exactly asGetView(false)returns it: field numbers instead of captions, the form the documentation recommends for feedingSetViewlater, because captions change with translations.
Solve it with Pro
You’re reading the opening of the statement. Pro unlocks the whole problem:
- The full statement
- Starter code in the browser editor
- 12 grading tests, run on Business Central 28.5
- 3 hints
- The reference solution
Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.
Already on Pro? Sign in