Discussion:
QueryBuildDataSource and crosscompany
(too old to reply)
Sascha
2010-08-05 08:42:03 UTC
Permalink
Hello,

I have a similar Form/Table - constellation like the SalesTable - form.
I have SalesTable-records and SalesLine-records.

The difference is, that "my" salesTable is in a VirtualCompany and I show
the SalesLine-records from all appropriate Companys.

Now under certain conditions I want to see only SalesTable-records with at
least one SalesLine-record.
Therefor I have created a QueryBuildDataSource on the Form and added the
following code in the init() of the SalesTable_DS:
qbdsExistsJoin =
this.query().dataSourceTable(this.table()).addDataSource(tablenum(SalesLine));
qbdsExistsJoin.relations(true);
qbdsExistsJoin.joinMode(JoinMode::ExistsJoin);

With this, the form shows all SalesTable-records which have at least one
SalesLine-record in the current company. But I want also to show
SalesTable-records which have SalesLine-record(s) in all companies.

So the question:
Is there a way to set the QueryBuildDataSource to crosscompany?
In the methodList of the qbds I only find .company()...
Klaas Deforche
2010-08-05 09:30:03 UTC
Permalink
Hi Sascha,

Take a look at you query variable, it has a property allowCrossCompany.

When you set this to true, it should select records from all companies
query .allowCrossCompany( true );

If you want to specify which companies to select from, use the
addCompanyRange() method:
query .addCompanyRange( 'CEE' );
query .addCompanyRange( 'CEU' );

Code from here
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.axapta.programming&tid=736f7773-9c33-4c8c-a299-acef3871e9b4&cat=&lang=&cr=&sloc=&p=1

Hope this helps,
Best regards,
Klaas Deforche.
----------------
http://www.artofcreation.be
Post by Sascha
Hello,
I have a similar Form/Table - constellation like the SalesTable - form.
I have SalesTable-records and SalesLine-records.
The difference is, that "my" salesTable is in a VirtualCompany and I show
the SalesLine-records from all appropriate Companys.
Now under certain conditions I want to see only SalesTable-records with at
least one SalesLine-record.
Therefor I have created a QueryBuildDataSource on the Form and added the
qbdsExistsJoin =
this.query().dataSourceTable(this.table()).addDataSource(tablenum(SalesLine));
qbdsExistsJoin.relations(true);
qbdsExistsJoin.joinMode(JoinMode::ExistsJoin);
With this, the form shows all SalesTable-records which have at least one
SalesLine-record in the current company. But I want also to show
SalesTable-records which have SalesLine-record(s) in all companies.
Is there a way to set the QueryBuildDataSource to crosscompany?
In the methodList of the qbds I only find .company()...
Sascha
2010-08-05 09:40:03 UTC
Permalink
If I use
query .allowCrossCompany( true );
on my "Main-DataSource" (SalesTable) the form shows one "SalesTable"-record
for every company in which I have a appropriate "SalesLine"-record.
That means, that the SalesTable with the id "23234" is shown 3 times, if
there are SalesLine-Records in the companies "ceu", "cee" and "tst".

The "allowCrossCompany" - property on the SalesTable-DS is set to "no",
because the "crosscompany" - select comes automatically because the
SalesTable is in the virtual company.
Post by Klaas Deforche
Hi Sascha,
Take a look at you query variable, it has a property allowCrossCompany.
When you set this to true, it should select records from all companies
query .allowCrossCompany( true );
If you want to specify which companies to select from, use the
query .addCompanyRange( 'CEE' );
query .addCompanyRange( 'CEU' );
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.axapta.programming&tid=736f7773-9c33-4c8c-a299-acef3871e9b4&cat=&lang=&cr=&sloc=&p=1
Hope this helps,
Best regards,
Klaas Deforche.
----------------
http://www.artofcreation.be
Loading...