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.  Merging Duplicate rows in a Sheet

    Employee
    Posted 01-31-2018 10:01

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

    Originally posted by: Jagdev

    Hi Experts,

    Please let me know if it is possible to merge duplicate rows into single row in a data file.

    Regards,
    Jagdev


  • 2.  RE: Merging Duplicate rows in a Sheet

    Employee
    Posted 01-31-2018 11:32

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

    Originally posted by: stonysmith

    There are basically two methods you can use.. one is to use AGG, but a slightly simpler version is to use Sort-Unique

    There is a shortcut you can use to simplify the need to list ALL columns. It's used in this example:
    node:Sort
    bretype:core::Sort
    editor:sortkey=5a720a5a138f6fef
    input:@40fd2c743ebf4304/=Static_Data.40fe6c55598828e5
    output:@40fd2c746a2a3b47/=
    prop:CompareOrderExpr=<<EOX
    map(&field, inputFields())
    EOX
    prop:Unique=true
    editor:XY=810,480
    end:Sort


  • 3.  RE: Merging Duplicate rows in a Sheet

    Employee
    Posted 02-02-2018 09:44

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

    Originally posted by: Jagdev

    Hi Stony,

    This looks good. I have bit different requirement i.e. Say the primary column where I need to check the duplicate is column name “Name” as per the inline sample. If it finds the duplicate in a column then the merging should happens the way it is mentioned in the output section.

    Name Place Price
    Ram Mumbai 50
    Ram Pune 60
    Shyam Mumbai 70
    Sam Delhi 100

    Output
    Name Place Price
    Ram Mumbai/Pune 110
    Shyam Mumbai 70
    Sam Delhi 100

    Please let me know if you need further clarification.

    Regards,
    Jagdev


  • 4.  RE: Merging Duplicate rows in a Sheet

    Employee
    Posted 02-02-2018 10:42

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

    Originally posted by: stonysmith

    node:Agg_Ex_3
    bretype:core::Agg Ex
    editor:sortkey=5a74a16064b23701
    input:@4b4668c040aa5a85/=Static_Data.40fe6c55598828e5
    output:@4b4668e708143fb4/=
    prop:GroupBy=<<EOX
    'Name'
    EOX
    prop:Script=<<EOX
    t=groupSum(Price)
    p=groupString(Place,"/")
    emit referencedFields(1,{{^GroupBy^}})
    where lastInGroup
    emit p as Place
    emit t as Price
    EOX
    prop:SortInput=true
    editor:XY=970,490
    node:Bypass
    bretype:::Bypass
    editor:shadow=4b467f7e02db3a85
    input:@4b467f7e129d45c1/=
    input:@4b467f830ffe047b/=
    output:@40fd2c7436717256/=
    end:Bypass
    
    node:Sort
    bretype:::Sort
    editor:shadow=4b467f8972dc33df
    input:@40fd2c743ebf4304/=
    output:@40fd2c746a2a3b47/=
    end:Sort
    
    node:Agg
    bretype:::Agg
    editor:shadow=4b467f9b3d5028c0
    input:@40fd2c7427456e5b/=
    output:@40fd2c744c862db0/=
    end:Agg
    
    end:Agg_Ex_3
    
    node:Static_Data
    bretype:core::Static Data
    editor:sortkey=5a74a15010766718
    output:@40fe6c55598828e5/=
    prop:StaticData=<<EOX
    Name,Place,Price:long
    Ram,Mumbai,50
    Ram,Pune,60
    Shyam,Mumbai,70
    Sam,Delhi,100
    EOX
    editor:XY=880,490
    end:Static_Data


  • 5.  RE: Merging Duplicate rows in a Sheet

    Employee
    Posted 03-12-2018 02:30

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

    Originally posted by: Jagdev

    Hi Stony,

    This is what I was trying to achieve!

    Regards,
    Jagdev