The relation "emplTable.EmplId==projvalEmplProjSetup.EmplId" doesn't seem to be specified in the queryBuild form of the query.  Is that supposed to be there or not?

Steeve...


-----Message d'origine-----
De�: Stefan Osterburg [mailto:[EMAIL PROTECTED]
Envoy�: 10 janvier 2005 15:54
��: [email protected]
Objet�: [development-axapta] problems creating a complex with querybuild



Hi,

I am trying to create a somewhat more complex query as a form datasource

I want to get all records from EmplTable, that have
neither have a corresponding record in projvalEmplProjSetup
for a certain project ("someprojid") nor records for other
projects whose daterange includes a certain date ("somedate").

in "Axapta-SQL" the following _expression_ does what I need:

while select emplTable
   notexists join projvalEmplProjSetup where
              emplTable.EmplId==projvalEmplProjSetup.EmplId &&
              (projvalEmplProjSetup.Projid==someprojid ||
         (projvalEmplProjSetup.myStartDate<=somedate &&
          projvalEmplProjSetup.myEndDate>=somedate))


I have not yet been able to get this working with the
a querybuild object. The biggest problem is getting
the OR/AND-conditions in the where _expression_ to work.

If have tried the following, but it does not give the correct
results:

     q = new Query();
     qBR1 = q.addDataSource(tablenum(EmplTable));
     qBR2 = qBR1.addDataSource(tablenum(ProjValEmplProjSetup));
     qBR2.relations(true);
     qBR2.joinMode(JoinMode::NotExistsJoin);
     range=qBR2.addRange(fieldnum(ProjValEmplProjSetup, projid));

     range.value(strfmt(' %1)  || ((%2.%3 <= %5) && (%2.%4 >= %5)',
                           someprojId,
                           q.datasourceno(1).name(),
                           fieldstr(ProjValEmplProjSetup, myStartDate),
                           fieldstr(ProjValEmplProjSetup, myEndDate),
                           queryvalue(somedate),
                           fieldstr(ProjValEmplProjSetup, ProjId)));

Can anyone help?

Stefan







Yahoo! Groups Links












Yahoo! Groups Links

Reply via email to