Filter table using data from another filtered table

haihthhaihth Member Posts: 32
Hi all members of Mibuso !

I'm creating report and have a problem.

How can i set a filter with table1 like SQL that:

select * from table1
where table1."document no" in (select documentno from table2 where table2.documentno like '%abc' and table2.date>'02/02/02')

I have a solution with item data:

table2 ( with filter on documentno and date)
--table1 ( with datalink documentno=documentno)

but i can not group data in table1 because table1 run step by step with document no of table2.

who can help me, thanks very much.

Comments

  • MBergerMBerger Member Posts: 413
    Make your report on table1 with the correct sorting for your grouping, and in the OnAfterGetRecord trigger check table2 en SKIP if the link isn't correct.
  • haihthhaihth Member Posts: 32
    MBerger wrote:
    Make your report on table1 with the correct sorting for your grouping, and in the OnAfterGetRecord trigger check table2 en SKIP if the link isn't correct.

    I already did:

    table1 - OnAfterGetRecord()

    table2.SETCURRENTKEY("documentno");
    table2.SETFILTER(table2.documentno,'*abc');
    table2.SETFILTER(table2.date,'080207');
    IF table2.FIND('-') THEN
    REPEAT
    IF NOT table2.GET(table1.documentno) THEN
    CurrReport.SKIP;
    UNTIL table2.NEXT=0;

    But it isn't working.

    Any idea for me?
    Thanks
  • David_SingletonDavid_Singleton Member Posts: 5,479
    haihth what are you trying to do?

    Forget the code and focus on the business need. Once you can describe the business requirement, the code will be a simple issue to resolve, but right now it seems you are not sure of the final objective.
    David Singleton
Sign In or Register to comment.