Selim
Aug 21, 2024 01:49 PM
Active user
Points:: 0
Joined:: Sep 27, 2023
Hi Experts, i want to get data from external data source ExternalDataSources.XXXX.Tables.XXXX; how can i get all table data and iterate it, i tried like below but gives me error For Each DataRow In ExternalDataSources.XXX.Tables.XXXX Do EndDo;
Profile
Aleksandr Biryukov
Sep 18, 2024 02:29 PM
Administrator
Points:: 0
Joined:: Oct 3, 2019
Hello Selim! None of the experts have answered you, so let me try to help you For first - could you provide a more complete code? And in general, it is better to work with external data sources using queries:
Code Query = New Query;
Query.Text =
"SELECT
| dbo_CURRENCIES.CODE AS CODE,
| dbo_CURRENCIES.NAME AS NAME,
| dbo_CURRENCIES.STATUS AS STATUS,
| dbo_CURRENCIES.EXTCODE AS EXTCODE
|FROM
| ExternalDataSource.RK_RKeeper7.Table.dbo_CURRENCIES AS dbo_CURRENCIES";
QueryResult = Query.Execute();
SelectionDetailRecords = QueryResult.Select();
While SelectionDetailRecords.Next() Do
// Insert selection processing SelectionDetailRecords
EndDo;
Profile
Peter Cross
Sep 23, 2024 10:41 PM
Active user
Points:: 0
Joined:: May 21, 2023
And how do you connect to external data source?
Profile
Aleksandr Biryukov
Oct 09, 2024 12:40 PM
Administrator
Points:: 0
Joined:: Oct 3, 2019
Hello Peter! How to connect to an external source - this is material for a small article... I have prepared several screenshots. I hope it will be clear to you how to connect. If you have any questions - ask!
Profile
Aleksandr Biryukov
Oct 09, 2024 12:42 PM
Administrator
Points:: 0
Joined:: Oct 3, 2019
First we add an external source in the Designer:
Profile
Aleksandr Biryukov
Oct 09, 2024 12:45 PM
Administrator
Points:: 0
Joined:: Oct 3, 2019
Select the tables whose data we want to work with. Also pay attention to screenshot 7 - it is necessary that the key field is filled in!
Profile
Aleksandr Biryukov
Oct 09, 2024 12:46 PM
Administrator
Points:: 0
Joined:: Oct 3, 2019
Now we launch 1C in working mode and open the External Source there:
Profile
Aleksandr Biryukov
Oct 09, 2024 12:47 PM
Administrator
Points:: 0
Joined:: Oct 3, 2019
There is one nuance here - when connecting for the first time, we need to specify the login and password again. Or the easiest way is to use the connection string, which can be copied from the Designer:
Profile
Aleksandr Biryukov
Oct 09, 2024 12:48 PM
Administrator
Points:: 0
Joined:: Oct 3, 2019
After this, we can work with the data in the tables directly:
Profile
Selim
Oct 09, 2024 04:11 PM
Active user
Points:: 0
Joined:: Sep 27, 2023
Thank you for your help. İs there another way to get all data from table without Query selection like below code For Each DataRow In ExternalDataSources.XXX.Tables.XXXX Do EndDo;
Profile
Aleksandr Biryukov
Oct 10, 2024 11:04 AM
Administrator
Points:: 0
Joined:: Oct 3, 2019
As far as I know, the table of the external data source cannot be iterated, so this code:
Code For Each a In ExternalDataSources.ExternalDataSource1.Tables.HumanResources_Employee Do
EndDo;
won't work.
But I'll check with the developers. Thanks for the question!
Profile
Selim
Oct 10, 2024 01:33 PM
Active user
Points:: 0
Joined:: Sep 27, 2023
Thank you for your help Sır
Profile
Subscribe