AndrewMozley
Programmer
I am modifying an existing report which is produced from table1.
The code which generates the report dives into several other tables for each record in table1 and produces the report. Although I do not have access to this code, there is an entry-point where I can restrict the number of records from which the report is produced.
So I can say (for example)
SELECT table1
SET FILTER TO cField1 < “M”
. . . let report continue
And this will produce the required subset of the report.
However the selection of records from table1 depends on the value of a record in a related table, table2, which holds the currency for the table1 record. Unfortunately the relationship is not simple.
Table 2 has a primary key consisting of cGroup + cAccount; both these fields are present in Table 1. The rule is :
If Table 1 has its cGroup field non-space, then the relevant record in Table 2 has a key :
Table1.cGroup + SPACE(8)
If Table 2 has its cGroup field as spaces. then the relevant record in table 2 has a key:
SPACE(3) + Table1.cAccount
I have tried writing this code to put a filter onto Table1 before the report does its thing :
LOCAL lString
lString = "cGroup + IIF(EMPTY(Table1.cGroup,cAccount,SPACE(8))"
SET RELATION TO &lString INTO SPRFLS
SET FILTER TO EMPTY(Table2.currency)
However this fails with the error message :
Too many arguments
I would be grateful for suggestions. As mentioned I have to work with the structure of the existing program.
Thanks. Andrew
The code which generates the report dives into several other tables for each record in table1 and produces the report. Although I do not have access to this code, there is an entry-point where I can restrict the number of records from which the report is produced.
So I can say (for example)
SELECT table1
SET FILTER TO cField1 < “M”
. . . let report continue
And this will produce the required subset of the report.
However the selection of records from table1 depends on the value of a record in a related table, table2, which holds the currency for the table1 record. Unfortunately the relationship is not simple.
Table 2 has a primary key consisting of cGroup + cAccount; both these fields are present in Table 1. The rule is :
If Table 1 has its cGroup field non-space, then the relevant record in Table 2 has a key :
Table1.cGroup + SPACE(8)
If Table 2 has its cGroup field as spaces. then the relevant record in table 2 has a key:
SPACE(3) + Table1.cAccount
I have tried writing this code to put a filter onto Table1 before the report does its thing :
LOCAL lString
lString = "cGroup + IIF(EMPTY(Table1.cGroup,cAccount,SPACE(8))"
SET RELATION TO &lString INTO SPRFLS
SET FILTER TO EMPTY(Table2.currency)
However this fails with the error message :
Too many arguments
I would be grateful for suggestions. As mentioned I have to work with the structure of the existing program.
Thanks. Andrew