4 Replies Latest reply: Dec 18, 2012 8:51 AM by John Cavoulas RSS

    Split Field into Multiple Fields

    John Cavoulas

      I have data that looks like this:

      Customer Apps.png

      And need to make it look like this:

      Customer Apps - Desired.png

       

      I've tried several script iterations such as:

       

      Load

           Customer Number,

           If(Application='App1','Y') as App1,

           If(Application='App2','Y') as App2,

           If(Application='App3','Y') as App3

      From CustomerApps;

       

      But that places the apps on separate rows per customer number.

       

      I also tried running the script one App at a time like this:

       

      Load

           Customer Number,

           If(Application='App1','Y') as App1

      From CustomerApps;

       

      Join

      Load

           Customer Number,

           If(Application='App2','Y') as App2

      From CustomerApps;

       

      Join

      Load

           Customer Number,

           If(Application='App3','Y') as App3

      From CustomerApps;

       

      But that too gives me a Cartesian product.

       

      One last attempt at loading the data straight like this:

       

      Load

           Customer Number,

           Application

      From CustomerApps;

       

      Then creating the fields in columns in a straight table such as  If(Application='App1','Y'),  If(Application='App2,'Y') and  If(Application='App3','Y') didn't work either. It only displayed apps when either App1, App2 or App3 was selected.

       

      It sure seems like I did this before but can't figure it out. Hopefully, one of you can get me there quickly.

      --john