LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Change data structure

    Employee
    Posted 02-25-2013 21:36

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: mwillett

    Hi there,

    I have data that reads across like this:

    ID, ValA1, ValA2, ValB1, ValB2, etc (for about 100 Vals)
    1,3,Y,2,N
    2,2,Y,,
    3,,,1,,


    The data is relatively sparse in that the for any one ID (i.e. row), only a few of the Values may be populated with a value. I haven't shown this in the sample data but you could imagine that all other values may not be populated.

    I would like to change the structure of the data so that it looks like this:

    ID, ValName, Value1, Value2
    1,A,3,Y
    1,B,2,N
    2,A,2,Y
    3,B,1,NULL

    Is this possible noting I am hoping to extract the value in the ValName field directly from the original field name; and would want a new record created if either of the values has something captured.

    Mike


  • 2.  RE: Change data structure

    Employee
    Posted 02-26-2013 07:05

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: xathras

    Mike,

    Are you looking to use something like Rotate maybe? Maybe you want to look at that node and see if thats what you're looking for?

    Wayne


  • 3.  RE: Change data structure

    Employee
    Posted 02-26-2013 21:53

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: mwillett

    I think Rotate is now deprecated in the version I have.

    I imagine its part Rotate but also needs to pull some meta-data from the field names to work so potentially a bit messy.

    It could all be manually coded but I was hoping for a smoother way.


  • 4.  RE: Change data structure

    Employee
    Posted 02-27-2013 10:56

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: rboccuzzi

    Mike, the Rotate node is deprecated, but it has been replaced with two Pivot nodes. I think you are going to want to use one or both of them. I am not sure exactly what you are trying to accomplish (some of the fields you are naming, not sure if they are needed or determined automatically, etc) but perhaps if you take a play with those nodes, you will get what you need, or further along at least, and we will be here if you get stuck. I think though, you are trying to do some partial name of field matching with values in the data, so I suspect it will be a bit messy when you are through, that's a bit unusual, I think.

    Cheers
    Rich


  • 5.  RE: Change data structure

    Employee
    Posted 03-01-2013 07:59

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: xathras

    Sorry yes Rotate is used. Used the Pivot. There was a good example of this on the forums. I'll dig out the link and post it.
    I adopted that in a piece of code we use and it has been working really well for us


  • 6.  RE: Change data structure

    Employee
    Posted 03-01-2013 08:36

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: xathras

    Here is the Link i was talking about. See the attachment from John P, http://community.lavastorm.com/showt...ghlight=rotate