DEV Community

Judy
Judy

Posted on

1 1 1 1 1

Determine whether to filter again based on the situation in the filtered result set #92

A table in the DB2 database is as follows:

Image description
Now we need to preliminarily filter out records with IDs equal to the specified parameters, and further process them based on whether the ABBREV field in the result set contains "A". If it contains "A", we will further filter out records that only contain "A" and return them; When 'A' is not included, return the preliminary filtering result directly.

For example, when the parameter is equal to 1, it should return:

Image description

When the parameter is equal to 2, return:

Image description

When the parameter is equal to 3, return:

Image description

SPL code:

Image description

A1: Use JDBC to query the database and preliminarily filter out records with IDs equal to the specified parameter.

A2: Further filter records with ABBREV equal to "A". If the result is an empty set, return A1; If the result is not an empty set, return the result of further filtering.

Open source SPL source address

Free Download

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more