BusinessObjects Board

How to create union, with VBA

Hello All,
I’am new in BusinessObjects, and i nead your help in my little problem.
Please, write me an example, how to create union query with VBA. I know, it sounds a little bit crazy, but i nead it :slight_smile:

Scenarios would be such:

  1. User creates and run query in BO.
  2. User press button which calls some procedure.
  3. Called procedure adds new SQL, and connects main SQL with new by union operator.

    Thanks for your help!

Evaldas (BOB member since 2004-04-29)

Are your data providers universe-based, freehand SQL, other? The answer is different for each.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

Dataprovider is universe-based.


Evaldas (BOB member since 2004-04-29)

After building the first query, you can then do a DataProv.Queries.Add method to add another tab. I believe the default Qry.Operator is union. Then proceed to build the second tab. You may find some of the code in this utility helpful to sort this out.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

Thansk a lot.

It’s my simple code:

Sub MakeUnion()
Dim Doc As Document
Dim DP  As DataProvider
Dim DQ  As Query
Dim Rez As Result
    
    Set Doc = ActiveDocument
    Set DP = Doc.DataProviders(1)
                
    DP.Load
    Set DQ = DP.Queries.Add
    Set Rez = DQ.Results.Add("ClassName", "ObjectName")
    DP.Unload
End Sub


Evaldas (BOB member since 2004-04-29)