![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello Folks We all know that "MultiValues" are meant to be one of the great differentiators of Pick from other system - but it has always troubled me that the SELECT statement (rather than LIST or SORT) does handle them well at all. This is something that has been niggling me for a while - particularly since many of us no longer rely on the LIST statement for producing reports - but rather use SELECT to grab data and then feed it into another display mechanism. This "niggle" has now turned into an irritation since one of my clients has a concrete situation that actually needs me to find a way to select on multivalued data. The main problem is that associations (between multivalued fields) are only respected at output time. For example, the WHEN clause in the Retrieve query language works only on output (e.g. LIST) statements - since it is effectively a filter at display time rather than at selection time. That is, WHEN does not apply value restriction to SELECT statements. As a concrete example, imagine I have the following: id salary bonus 001 100 10 200 250 002 300 20 400 450 500 550 003 600 40 700 650 Salary and bonus are defined in an association. I can do a LIST salary bonus WHEN salary < bonus which gives me something like the following: id salary bonus 001 200 250 002 400 450 500 550 What I actually want to do is a SELECT returning just the unique item ids of any item for which at least one bonus is greater than its associated salary. Thus, in this case I would like a select list containing two entries: 001 and 002. Is this possible? If so, please can you let me know how - because I have never been able to figure out a way to do it and I would really be deeply grateful for any insight you can give. Thanks Anthony p.s. I can't switch them over to an existing reporting tool that can handle such things - since this data ultimately needs feeding into a BASIC subroutine. p.p.s. The file in question has around 100 000 records, so writing a BASIC program to do the selection would be a non-starter in terms of performance relative to using the query language |
#3
| |||
| |||
|
|
On D3, I'd make a dictionary item with a correlative like: AIF 2 > 1 THEN "1" ELSE "0" and then do the select like: select file with BON_GT_SAL = "1" |
#4
| |||
| |||
|
| On D3, I'd make a dictionary item with a correlative like: AIF 2 > 1 THEN "1" ELSE "0" and then do the select like: select file with BON_GT_SAL = "1" Hello Mark This is my worry - that I have to make a dictionary. The problem with this approach is that it means I have to make a new dictionary for every type of multi-valued comparison the customer wants to do. Thus, if tomorrow they wanted everybody with a bonus > 1000 and a salary < 2000 (still respecting multivalued associations) I would have to make another dictionary specific to that query. What I was hoping for is a more general way of querying multivalued associated data, and it seems there is no way to do it - other that creating dictionaries in every case. I am using Universe, which does have the advantage that I can at least create "virtual dictionaries" on the fly via clever use of the EVAL clause. Not what I hoped for - but maybe it is the best I can achieve. Strange that there is no simple way to do it. I really cannot understand why WHEN is only applied on output - it seems like a very limiting decision when Pick is meant to have strong support for multivalued data Thanks for you advice Anthony Does Universe have an ANY clause. |
#5
| |||
| |||
|
|
Does Universe have an ANY clause. |
#6
| |||
| |||
|
|
Mark Brown wrote: Does Universe have an ANY clause. It does have an ANY clause, however it is just "filler" in the query used (according to the manual) to make the query more "english like" but is ignored by the query processor :-( |
#7
| |||
| |||
|
| On D3, I'd make a dictionary item with a correlative like: AIF 2 > 1 THEN "1" ELSE "0" and then do the select like: select file with BON_GT_SAL = "1" Hello Mark This is my worry - that I have to make a dictionary. The problem with this approach is that it means I have to make a new dictionary for every type of multi-valued comparison the customer wants to do. |
|
Thus, if tomorrow they wanted everybody with a bonus > 1000 and a salary < 2000 (still respecting multivalued associations) I would have to make another dictionary specific to that query. What I was hoping for is a more general way of querying multivalued associated data, and it seems there is no way to do it - other that creating dictionaries in every case. I am using Universe, which does have the advantage that I can at least create "virtual dictionaries" on the fly via clever use of the EVAL clause. Not what I hoped for - but maybe it is the best I can achieve. Strange that there is no simple way to do it. I really cannot understand why WHEN is only applied on output - it seems like a very limiting decision when Pick is meant to have strong support for multivalued data Thanks for you advice Anthony |
#8
| |||
| |||
|
|
Hello Folks We all know that "MultiValues" are meant to be one of the great differentiators of Pick from other system - but it has always troubled me that the SELECT statement (rather than LIST or SORT) does handle them well at all. snip |
#9
| |||
| |||
|
|
Hello Folks We all know that "MultiValues" are meant to be one of the great differentiators of Pick from other system - but it has always troubled me that the SELECT statement (rather than LIST or SORT) does handle them well at all. This is something that has been niggling me for a while - particularly since many of us no longer rely on the LIST statement for producing reports - but rather use SELECT to grab data and then feed it into another display mechanism. This "niggle" has now turned into an irritation since one of my clients has a concrete situation that actually needs me to find a way to select on multivalued data. The main problem is that associations (between multivalued fields) are only respected at output time. For example, the WHEN clause in the Retrieve query language works only on output (e.g. LIST) statements - since it is effectively a filter at display time rather than at selection time. That is, WHEN does not apply value restriction to SELECT statements. As a concrete example, imagine I have the following: id salary bonus 001 100 10 200 250 002 300 20 400 450 500 550 003 600 40 700 650 Salary and bonus are defined in an association. I can do a LIST salary bonus WHEN salary < bonus which gives me something like the following: id salary bonus 001 200 250 002 400 450 500 550 What I actually want to do is a SELECT returning just the unique item ids of any item for which at least one bonus is greater than its associated salary. Thus, in this case I would like a select list containing two entries: 001 and 002. Is this possible? If so, please can you let me know how - because I have never been able to figure out a way to do it and I would really be deeply grateful for any insight you can give. Thanks Anthony p.s. I can't switch them over to an existing reporting tool that can handle such things - since this data ultimately needs feeding into a BASIC subroutine. p.p.s. The file in question has around 100 000 records, so writing a BASIC program to do the selection would be a non-starter in terms of performance relative to using the query language |
#10
| |||
| |||
|
|
Hello Folks We all know that "MultiValues" are meant to be one of the great differentiators of Pick from other system - but it has always troubled me that the SELECT statement (rather than LIST or SORT) does handle them well at all. This is something that has been niggling me for a while - particularly since many of us no longer rely on the LIST statement for producing reports - but rather use SELECT to grab data and then feed it into another display mechanism. This "niggle" has now turned into an irritation since one of my clients has a concrete situation that actually needs me to find a way to select on multivalued data. The main problem is that associations (between multivalued fields) are only respected at output time. For example, the WHEN clause in the Retrieve query language works only on output (e.g. LIST) statements - since it is effectively a filter at display time rather than at selection time. That is, WHEN does not apply value restriction to SELECT statements. As a concrete example, imagine I have the following: id salary bonus 001 100 10 200 250 002 300 20 400 450 500 550 003 600 40 700 650 Salary and bonus are defined in an association. I can do a LIST salary bonus WHEN salary < bonus which gives me something like the following: id salary bonus 001 200 250 002 400 450 500 550 What I actually want to do is a SELECT returning just the unique item ids of any item for which at least one bonus is greater than its associated salary. Thus, in this case I would like a select list containing two entries: 001 and 002. Is this possible? If so, please can you let me know how - because I have never been able to figure out a way to do it and I would really be deeply grateful for any insight you can give. Thanks Anthony p.s. I can't switch them over to an existing reporting tool that can handle such things - since this data ultimately needs feeding into a BASIC subroutine. p.p.s. The file in question has around 100 000 records, so writing a BASIC program to do the selection would be a non-starter in terms of performance relative to using the query language |
![]() |
| Thread Tools | |
| Display Modes | |
| |