Hi,
I have a web application that reads a list of existing Crystal Report files allowing the user to select the report they wish to run. I also allow the user to restrict the report data by appending a list of client Ids. To do this I check if the client table is present in the report and if so create a new selection criteria e.g. "AND {Client.id} in [ "1234", "2345", "3456"]" and append this to the selection criteria.
This all works nicely however I now wish to allow a list of a 2nd set of Ids which relate to a different table. I do the same check for this 2nd table and again if present allow the appending. I can identify the source of each list of ids so know whether I have client ids or not.
My problem is that there may be reports containing both tables and if I append the wrong list of ids the report will be incorrect.
Is there a way to identify the primary table in a report e.g. the first table in the SQL select statement ??
example SQL:
select * from client left outer join secondtable on secondtable.key = client.key
Client is the 'primary' table so allow the appending of a list of client ids but not ids from the 2nd table.