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.  How to create a new column of Repeated values for a grouped column

    Employee
    Posted 10-13-2016 06:40

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

    Originally posted by: Rhalim

    Hi I am a Lavastorm newbie. At the moment I am reworking an Excel application and I need help in creating new columns from columns that have groupings. I will like to go from SD_Sample to SD_Sample2. I have attached the sample data below.
    I have tried adding a row_id and then using a do while loop. ButI have problems trying to initialise the code. I am not sure what syntax to use. Your assistance will be appreciated.

    node:SD_Sample
    bretype:core::Static Data
    editor:Label=SD_Sample
    editor:sortkey=57ff8c45257b783c
    output:@40fe6c55598828e5/=
    prop:StaticData=<<EOX
    University:String,Faculty:string,Department;String
    Abewe University,Engineering,Civil Engineering
    ,,
    ,,
    ,,
    Cranborne University,Medicine,Health Science
    ,,
    ,,Zoology
    ,,
    ,,
    ,,Changeology
    ,,
    ,Space,Space Vision
    ,,
    ,,Space Hires
    ,,
    ,,
    ,Botany,Plants
    EOX
    editor:XY=30,50
    end:SD_Sample
    
    node:SD_Sample2
    bretype:core::Static Data
    editor:Label=SD_Sample2
    editor:sortkey=57ff8c45257b783c_2
    output:@40fe6c55598828e5/=
    prop:StaticData=<<EOX
    University:String,Faculty:string,Department;String
    Abewe University,Engineering,Civil Engineering
    Abewe University,Engineering,Civil Engineering
    Abewe University,Engineering,Civil Engineering
    Abewe University,Engineering,Civil Engineering
    Cranborne University,Medicine,Health Science
    Cranborne University,Medicine,Health Science
    Cranborne University,Medicine,Zoology
    Cranborne University,Medicine,Zoology
    Cranborne University,Medicine,Zoology
    Cranborne University,Medicine,Changeology
    Cranborne University,Medicine,Changeology
    Cranborne University,Space,Space Vision
    Cranborne University,Space,Space Vision
    Cranborne University,Space,Space Hires
    Cranborne University,Space,Space Hires
    Cranborne University,Space,Space Hires
    Cranborne University,Botany,Plants
    
    EOX
    editor:XY=40,150
    end:SD_Sample2


  • 2.  RE: How to create a new column of Repeated values for a grouped column

    Employee
    Posted 10-13-2016 10:43

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

    Originally posted by: stonysmith

    Put this code into a filter:

    #setup dummy values
    if firstExec then {prioru="" priorf="" priord=""}  
    
    #Check if incoming value is empty, if it is, use the prior value
    if 'University'=="" then u=prioru else u='University'
    if 'Faculty'==""    then f=priorf else f='Faculty'
    if 'Department'=="" then d=priord else d='Department'
    
    #write out the data
    emit u as University
    emit f as Faculty
    emit d as Department
    
    #save the current value for next cycle
    prioru=u
    priorf=f
    priord=d


  • 3.  RE: How to create a new column of Repeated values for a grouped column

    Employee
    Posted 10-25-2016 05:41

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

    Originally posted by: Rhalim

    Hi Stonysmith, I just got back from a break and saw your response. It works great. Thank you. In the first line of the filter you set up the values for 3 variables using curly brackets.
    if firstExec then {prioru="" priorf="" priord=""} Is this called an array? How can I find out more about it ?


  • 4.  RE: How to create a new column of Repeated values for a grouped column

    Employee
    Posted 10-25-2016 06:32

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

    Originally posted by: stonysmith

    No, that's not an array... it's just a group of statements.
    Like C++ and Java, anything within the {} is treated as though it was a single statement.
    It could also be written this way:

    if firstExec then {
    prioru=""
    priorf=""
    priord=""
    }