Forum Discussion

srmorrison's avatar
srmorrison
Ideator I
2 years ago

How to use a query to get distinct values from a item table

Community,

I have created a staging table capability that will be used to generate innovator eBOMs from Oracle manufacturing BOMs.

My challenge is working with 1.7 million rows of data in SQL Server.

I know I could create a SQL procedure to get the unique (distinct) oracle Assembly IDs but I would like to use a Query Definition.

In the data model below, what is circled in RED is the Oracle Data. What is circled in Blue is where I am separating a
    1) [multi-Division, multi-Ora Org, with non distinct Assemblies (by Ora Org)] : stg_Oracle_MfgItem_MfgItem

     INTO

    2) [single-Division, multi-Ora Org, Distinct Primary Assemblies] stg_eBOM_PartBOM_Primary

     AND

    3) [single-Division, multi-Ora Org, Other Assemblies (without Primary PartBOM)] stg_eBOM_PartBOM_Other

The goal is as follows:

  2) stg_eBOM_PartBOM_Primary will be used to generate the innovator [Part BOM] relationships

  3) stg_eBOM_PartBOM_Other will be compared to stg_eBOM_PartBOM_Primary to derive Substitutes

So I would like to use a Query Definition to gather all the Distinct Oracle Assembly IDs so I can populate the stg_eBOM_PartBOM_Primary table.

Thanks in advance for your time and insight.

Scott

6 Replies

  • Hi Scott

    If Aras ever reintroduce their community awards, you already set the bar quite high for the "best description images for complex forum questions" category [emoticon:44a8a53ad3364ea78a16c5a3229f75bb]

    Is your final goal a TreeGridView that shows the BOM based on the Oracle data? (So you don´t really create new items, but do something like a federated view?)

    Or do you want to rebuilt the BOM / add new BOM items? For this use case, a Query Definition sounds like the hardest way to do the task.

    Is this a task you do once for data migration, or shall the data be updated on a regular basis?

    • srmorrison's avatar
      srmorrison
      Ideator I

      Hello Angela,

      Thanks for the Shout out!

      This is a data Migration/Transformation/Loading excercise. A tree Grid View will never be applied.

      The Oracle mBOM Relational Data (structure) will be use to construct PLM eBOMS and PLM mBOMs, then it will be chucked.

      It is being done for 1 division now and will be done for other divisions after the completion of this initial effort.

      I wanted to use a Query Definition based:

      1) Performance

      2) Easily adaptable to other Divisions.

      3) Trying to aviod the use of SQL.

      4) Easier to pass off to the client for re-use.

      The client has implemented mBOMs before eBOMs which will makes this very challenging assignment.

      Here is an updated Data Model.

      • AngelaIp's avatar
        AngelaIp
        Ideator I

        Fortunately, the Aras award for “Customer who asked the Aras support team the strangest and most bizarre questions about trivial details in Innovator” will forever remain in my hands.[emoticon:0e469978eb8947d18b9c41123db3725a]

        Unfortunately I am not the best person to answer questions regarding Query Definition. Maybe somebody else knows more about this one?

        Question that I have right now:

        - How can we "add" new items based on "get" Query Definition? Do you have done something like this before?

        - Do you made some attempts to build the Query Definition already? You mentioned that you want to build a query with DISTINCT. I wonder if this is possible with the regular Query Definition. You can build more complex Query Definitions if you don´t use the visual editor but edit the items that build the query directly (unhide the relationship in the Query Definition ItemType). But this will lead to the same problem you will have with SQL -> it´s not obvious for other users anymore.

        It´s not impossible to "pass" SQL components to other users. You can use the SQL ItemType and use a Method that does a sample call. In my case I have a whole bunch of Methods and SQL stuff with the name “Admin” or similar that is just intended to document certain special tasks. I even have a complete folder on the main server with "SQL scripts" for all kind of maintenance stuff, like repairs, cleanup, data validation, procedure tests, etc. . 

        But I understand the advantage of using the Query Definition, so I hope there is a solution!