Hi,
Greetings!
I have created a view with tables "Ledger" and "CompanyInfo".
On the "CompanyInfo" data source I added a range as "DataArea = (CurrentCompany())"
The expected behavior is to select the current company records, instead the view returns only "Dat"
company records.
Regards,
Abhinay
I changed the order of the tables in the datasource, started with the table with property "save data per company" set to true, and the view got filtered at runtime.
"currentCompany()" did not help.
I guess the range is part of the view definition which gets synced to the database. This means that currentCompany() is interpreted during sync time, not runtime. So it doesn't work dynamically. You can verify this by looking at the view definition in SQL server.
This means you need to add your range value in x++ code in runtime, instead of having it in the view definition.
Hi Nikolaos,
Thank you for your reply.
Please refer the link
It returns the records from all the companies.
Hi Abhinay,
To diagnose this, I suggest you create a view with following datasources added. Ledger -> CompanyInfo linking Ledger.PrimaryForLegalEntity with CompanyInfo.RecId. Then in the view you add a field Ledger.Name and CompanyInfo.DataArea field.
First write a job to loop through this view and display both the fields in info. Please test this and let me know what your result is.
Then when you use this view in your form, you can add range for this view as qbds.addRange(fieldNum(View, DataArea)).value(queryValue(curExt()));
What if you remove this range, does it then return only data from current company? I would expect it to do that.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 1,239
André Arnaud de Cal... 767 Super User 2025 Season 2
Sohaib Cheema 672 User Group Leader