Question
Criteria Apply Differently in LIST vs SELECT
Hi Folks,
First time posting here, but I've been working with UniData for about 5 years now after mostly working with MySQL and Oracle databases. We get UniData through a VAR, but I'm pretty sure they think I'm crazy so hoping to get some wisdom from the community here.
I've got a computed column ADDR.G82.SANITY.CHECK defined as
SUBR("CC.G82.ADDRESS.SANITY.CHECK",COUNTRY,STATE,ZIP)
The subroutine opens another entity and selects against it to try to match postal code first letter to province and state to ZIP to see if addresses look "sane".
If I use the computed column in SELECT criteria with an active list, it fails with wildly wrong results. However, if I execute a
SELECT ADDRESS WITH COUNTRY = 'CN' SAMPLE 1000
SAVE.LIST CNADDR
GET.LIST CNADDR
LIST ADDRESS COUNTRY STATE ZIP WITH ADDR.G82.SANITY.CHECK = 'Y'
<<lists 922 correct records>>
Trying it with SELECT
GET.LIST CNADDR
SELECT ADDRESS WITH ADDR.G82.SANITY.CHECK = 'Y'
<<returns two records, not 922>>
The generated code does do some list protection, but I'm wondering if SELECT possibly does some parallel processing that make list protection logic prone to failure when executed in computed columns?
So, I guess I'm hoping someone can shed some light on the internals of select vs list criteria application. Or if there are best practices for applying select criteria in a CC subroutine?
First time posting here, but I've been working with UniData for about 5 years now after mostly working with MySQL and Oracle databases. We get UniData through a VAR, but I'm pretty sure they think I'm crazy so hoping to get some wisdom from the community here.
I've got a computed column ADDR.G82.SANITY.CHECK defined as
SUBR("CC.G82.ADDRESS.SANITY.CHECK",COUNTRY,STATE,ZIP)
The subroutine opens another entity and selects against it to try to match postal code first letter to province and state to ZIP to see if addresses look "sane".
If I use the computed column in SELECT criteria with an active list, it fails with wildly wrong results. However, if I execute a
SELECT ADDRESS WITH COUNTRY = 'CN' SAMPLE 1000
SAVE.LIST CNADDR
GET.LIST CNADDR
LIST ADDRESS COUNTRY STATE ZIP WITH ADDR.G82.SANITY.CHECK = 'Y'
<<lists 922 correct records>>
Trying it with SELECT
GET.LIST CNADDR
SELECT ADDRESS WITH ADDR.G82.SANITY.CHECK = 'Y'
<<returns two records, not 922>>
The generated code does do some list protection, but I'm wondering if SELECT possibly does some parallel processing that make list protection logic prone to failure when executed in computed columns?
So, I guess I'm hoping someone can shed some light on the internals of select vs list criteria application. Or if there are best practices for applying select criteria in a CC subroutine?