ECLRollUp-class: Class '"ECLRollUp"'

Description Fields Methods Examples

Description

Creates an ECL "ROLLUP" definition. The ROLLUP function is similar to the DEDUP function with the addition of the call to the transform function to process each duplicate record pair. This allows you to retrieve valuable information from the "duplicate" record before it's thrown away.

Fields

name:

Object of class character Class name.

inDataset:

Object of class ECLDataset Input record name.

outECLRecord:

Object of class ECLRecord Output record name.

condition:

Object of class character An expression that defines "duplicate" records. The keywords LEFT and RIGHT may be used as dataset qualifiers for fields in the recordset

def:

Object of class character ECl definition/code.

Methods

print():

Prints the ECL code.

addField(id, value):

Used to add ECL definitions.

getName():

Returns class name.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  ## Not run: 
    ecl1 <- ECL$new(hostName="127.0.0.1", port="8008")
    recPerson <- ECLRecord$new(name="rec_person")
    recPerson$addField("STRING", "code")
    recPerson$addField("STRING", "firstName")
    recPerson$addField("STRING", "lastName")
    recPerson$addField("STRING", "address")
    recPerson$addField("STRING", "stateCode")
    recPerson$addField("STRING", "city")
    recPerson$addField("STRING", "zip")
    ecl1$add(recPerson)
    
    dsPerson <- ECLDataset$new(name="ds_person", datasetType = recPerson, 
                  logicalFileName ="~ds::person", fileType="CSV")
    ecl1$add(dsPerson)
    
    recPersonContact <- ECLRecord$new(name="rec_myRec")
    recPersonContact$addField(dsPerson$getName(), "firstName", seperator=".")
    recPersonContact$addField(dsPerson$getName(), "lastName", seperator=".")
    
    ecl1$add(recPersonContact)
    
    tblPerson <- ECLTable$new(name="LnameTable ", inDataset = dsPerson, 
                      format= recPersonContact)
    ecl1$add(tblPerson)
    
    sort <- ECLSort$new(name="sortedTable", inDataset = tblPerson)
    sort$addField("firstName")
    ecl1$add(sort)
    
    condition <- "LEFT.firstName = RIGHT.firstName"
    rollUp <- ECLRollUp$new(name="TransformPersons ", inDataset=sort, 
                  outECLRecord=recPersonContact, condition = condition);
    rollUp$addField("SELF", "LEFT");
    ecl1$add(rollUp)
    ecl1$print()
  
## End(Not run)

rHpcc documentation built on May 2, 2019, 11:04 a.m.

Related to ECLRollUp-class in rHpcc...