3 Replies Latest reply: Dec 10, 2010 3:01 PM by ivan_cruz RSS

    Concat in load statement

    Kelly Korynta

      Hi all,

      I'm using this as a reference: http://community.qlik.com/forums/p/32145/124107.aspx#124107

       

      I'm trying to do something similar, where have have ID1 and ID2, where by themselves are not unique, but together it creates a unique ID. I'd like to concatenate the two fields together to create a unique ID in the load statement. Here's the code I have so far

      LOAD @1 as [Customer Entity],
      @2 as [Staff Entity],
      @3 as [Revision No],
      @4 as [Last Name],
      @5 as [First Name],
      @6 as [Entity Qualifier],
      @7 as Registered,
      @8 as [Provider Type],
      text(trim(@9)) as [Code Key],
      concat(total @1 &@2, ';') as [Special ID]
      FROM [C:\

       

      While this loads, the results is "(internal error)"

       

      Can someone point out my error?

        • Concat in load statement

          Hi there, notice the concat function will only work in the context of the GUI. If you are working in the script you can concatenate the values as follows:

          Load *,

          @1 & '-' & @2 as KeyField

          from table;

          However, I would suggest to use some of the autonumber flavors in order to have the ID's represented as integers instead of linking through text values.

          Load *,

          autonumber(@1 & '-' & @2) as KeyField

          from table;

           

          You can also use:

          Load *,

          autonumberhash256(@1 , @2) as KeyField

          from table;

           

          Regards