2 Replies Latest reply: Jun 10, 2015 3:44 AM by Anders Jungbeck RSS

    merge two mapping files into one

      Hi,

       

      I have 2 different mapping files MapA and MapB having the common ID field. I want to merge them into one QV table having the ID as Key, as follows:

      NewMap.ID

      NewMap.Type = MapA.Type or MapB.Type depending on which of the tables having a value for that field.

       

      I have tried diffrent methods but the one getting close to work (but just close) is.

      Load MapA

      Load MapB while renaming all the fields to unique names

      Give me a MaPA table that is auto concatenated on ID and contains all the fields from MapA and MapB

       

      I then load MaPA into NewMap testing if(isnull(MapA.AType), MapA.Btype, MapA.Atype) as NewMap.Type

      The consequences is unfortunately that I get duplicated ID's in NewMap table

       

      Do I need to use the Qualify function or is it other ways to do it.

       

      Thanks

      A

        • Re: merge two mapping files into one
          Sushil Kumar

          Hi,

           

          See if the below logic works for you:

           

          Load MapA from table;

           

          Load MapB from table

          where not exist(ID);

           

          and after that remove null from the table

           

          HTH

          sushil

            • Re: merge two mapping files into one

              Thanks sushil,

               

              Sorry being a bit new I do not fully follow the logic.

              What do you mean by where not exist(ID)?

              And how do you remove null from the table?

               

              I might have explained the issue badly.

              MapA.ID     MapA.Type     MapA.SubType

              1                    Atype          null

              2                    Btype          CSubType

              3                    null               DSubType

               

              MapB.ID          MapB.Type     MapB.SubType

              1                         null             BSubType

              3                        Btype          null

               

              To become

              NewMap.ID     NewMap.Type     NewMap.SubType

              1                    Atype                    BsubType              

              2                    Btype                    CsubType

              3                    Btype                    DsubType

               

              BR

              Anders