UNION Select across multiple data connections?


Author
Message
William Fields
William Fields
StrataFrame User (326 reputation)StrataFrame User (326 reputation)StrataFrame User (326 reputation)StrataFrame User (326 reputation)StrataFrame User (326 reputation)StrataFrame User (326 reputation)StrataFrame User (326 reputation)StrataFrame User (326 reputation)StrataFrame User (326 reputation)
Group: StrataFrame Users
Posts: 80, Visits: 239
Hello,

I have a BO (my first, yea!) that grabs the data I'm looking for and all is well in the universe.

Now, I have a requirement to combine data from multiple data sources (same table structure, but the data is living on different SQL Servers) and I'm figuring a UNION would give me what I need.  This is a read-only scenario, so I don't need to worry about updates being sent back to the different servers (yet).

I have not gone through the process of adding additional data sources to my project yet, but I will review the documentation on how to set that up. After that, I guess the trick is how to select data from different servers into the BO dataset...

Any suggestions?

Thanks.
Reply
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi William,

I don't know about the UNION, but you can create several instance of your BO by code, fill each with data from different sources, then use the BO.CopyDataFrom method to combine all BOs in a single one, some like this:


Dim Mainbo1 as new MyBusinessObject
Dim TempBO2 as new MyBusinessObject
Dim TempBO3 as new MyBusinessObject

'-- Now fill TempBO2 and TempBO3 from different datasources
TempBO2.DataSourceKey = "VFP"
TempBO2.CustomFillMethod()

TempBO3.DataSourceKey = "SQL"
TempBO3.CustomFillMethod()

'-- Now combine bo2 and bo3 into bo1
MainBO1.CopyDataFrom(TempBO2, BusinessCloneDataType.AppendDataToTableFromDefaultView)
MainBO1.CopyDataFrom(TempBO3, BusinessCloneDataType.AppendDataToTableFromDefaultView)


The above is just a pseudo code so you can see the logic.  If you want to go this route, make sure you read about the CopyDataFrom method in the help file.  Also you may need to add validations to Clear and dispose the temporary BOs.

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search