Smart Lists in Action: DDDW and DDLB Validation in PowerBuilder 2025 R2

Luis Avilan
CODE AUTHOR
Posts: 40
 5 days 18 hours ago #726 by Luis Avilan
Luis Avilan created the code: Smart Lists in Action: DDDW and DDLB Validation in PowerBuilder 2025 R2

Smart Lists in Action: DDDW and DDLB Validation in PowerBuilder 2025 R2

A database-free lab that turns dropdowns into visible, measurable rules for null values, unknown codes, orphaned dependencies, empty lists, and inactive records.

 

A dropdown does not validate the meaning of its data by itself. The interface may display a reasonable label while the stored value is null, unknown, inactive, or incompatible with another selection.

What the lab demonstrates

Demo_validacion_dddw places two familiar PowerBuilder mechanisms under the same test conditions. A DropDownDataWindow (DDDW) presents data from another DataWindow, separates the displayed column from the stored column, and supports dynamic filters. A DropDownListBox (DDLB) keeps a direct mapping between labels and codes inside the column definition.

The w_laboratorio_validacion window loads every catalog in memory, applies seven repeatable scenarios, inspects each control's internal value, and updates a live validation monitor. The entire behavior can be studied without SQLCA, a database server, or external data.

 

 

 

 

 

 

 

Key script 1: a truly dependent DDDW

 

 

GetChild("ciudad_id", ldwc_ciudades) exposes the DataWindow that supplies the column. The function first restores all rows with SetFilter("") and Filter(), preventing a new condition from being layered over an old one. It then creates one of two expressions:

  • departamento_id = n keeps only the cities related to the current selection.
  • ciudad_id = -1 deliberately produces an empty list for the edge-case test.
Important detail: the city value is validated against the rows that remain in the filtered DDDW. A city may exist in the complete catalog and still be invalid for the current department; the lab reports that condition as DEPENDENCIA, meaning a dependency error.

Key script 2: a pipeline that explains the failure

 

 

of_validar_formulario evaluates department, city, category, and priority separately. The form is valid only when all three required fields are valid and priority is either valid or null. It then applies a deliberate diagnostic order:

  1. An inactive department value.
  2. A city DDDW with no available rows.
  3. A city that does not belong to the selected department.
  4. A missing required value.
  5. Any code that cannot be found.

This ordering avoids vague feedback. The monitor can show Warning · empty list or Dependency error instead of hiding every cause behind a generic “invalid data” message.

Seven cases that challenge assumptions

Case What it triggers Expected result
1. Valid selection Every code exists and the dependency is consistent. VALID
2. Unknown DDDW value Injects a department identifier that is absent from the catalog. NOT FOUND
3. Unknown DDLB value Assigns a category code outside the configured list. NOT FOUND
4. Null values Clears required fields while leaving optional priority empty. REQUIRED VALUE MISSING
5. Orphaned dependency Combines a department with a city excluded by the active filter. DEPENDENCY ERROR
6. Empty DDDW list Applies a filter that leaves no available cities. EMPTY LIST
7. Inactive value Selects an existing department marked as inactive. INACTIVE VALUE

Why the displayed label is not enough

In a DDDW, dddw.displaycolumn controls what the person sees, while dddw.datacolumn determines what is actually stored. The department field displays Tecnologías de la Información, yet stores the numeric identifier 10. The inspector places both representations side by side and makes the distinction visible.

DDLB columns follow the same principle through pairs such as Prémium / PRE and Alta / A. The NVO validates stored codes rather than translated labels. This keeps business rules stable when user-facing wording changes.

A visual fix with architectural consequences

The main DataWindow is designed as a freeform layout with controls arranged vertically. That is why d_formulario_validacion uses processing=0. In tabular presentation, the same coordinates are interpreted differently: fields spread horizontally and several choices move outside the visible area.

Practical lesson: successful compilation does not prove that the user experience is correct. When a form looks flattened or incomplete, inspect its presentation mode before rewriting every coordinate.

How to explore the demo

  1. Open the lab and inspect the initial valid selection.
  2. Change the department and confirm that the city list is recalculated.
  3. Walk through all seven cases with Previous and Next.
  4. Choose a column under Break validation, enter an internal value, and click Inject test value.
  5. Compare the stored value, displayed value, available rows, and diagnosis.
  6. Use the lower log to reconstruct each change and validation pass.

Conclusion

This lab turns behavior that often remains hidden inside the DataWindow into an observable experience. DDDW and DDLB are not rivals: they solve different problems. The first excels with rich, dependent catalogs; the second with small, predictable sets. Both become reliable when code validates the stored value, its catalog membership, and the surrounding context that gives it meaning.

The pattern is reusable: short functions, isolated catalogs, specific error states, and a monitor that exposes what actually happened. It lets a team test validation rules before connecting a database and reduces surprises when the form reaches production.

Luis Avilan

 

This message has an attachment file.
Please log in or register to see it.

Please Log in or Create an account to join the conversation.