Skip to content
HPCCSystems Solutions Lab
HPCCSystems Solutions Lab

ROWS

ROWS keyword indicates the parameter being passed to the TRANSFORM function is a data set. ROWS is used in functions where a dataset is being passed, such as ROLLUP, JOIN, and DENORMALIZE when the GROUP option is used.

Example


/*
ROWS Example:
*/

ParentLayout := RECORD
    STRING      fName;
    STRING      lName;
END;


parentDS := DATASET
    (
        [
            {'Jane', 'Carpenter'},
            {'Bill', 'Smith'},
            {'Orville', 'Black'}
        ],
        ParentLayout
    );

OUTPUT(parentDS, NAMED('parentDS'));


ChildrenLayout := RECORD
    STRING      fName;
    STRING      lName;
    UNSIGNED1   age;
END;

childrenDS := DATASET
    (
        [
            {'Fiona', 'Black', 9},
            {'Jack', 'Black', 18},
            {'Martin', 'Carpenter', 10},
            {'Stacey', 'Smith', 5},
            {'Allison', 'Smith', 7}
        ],
        ChildrenLayout
    );

OUTPUT(childrenDS, NAMED('childrenDS'));

ParentChildLayout2 := RECORD
    ParentLayout;
    SET OF STRING   children;
END;

denorm2 := DENORMALIZE
    (
        parentDS,
        childrenDS,
        LEFT.lName = RIGHT.lName,
        GROUP,
        TRANSFORM
            (
                ParentChildLayout2,
                SELF.children := SET(ROWS(RIGHT), fName),
                SELF := LEFT
            )
    );

OUTPUT(denorm2, NAMED('denorm2'))
Try Me

Syntax

When using ROWS you need to pass the dataset you are pointing to in the TRANSFORM. So ROWS can be used as ROWS(LEFT) or ROWS(RIGHT).

function(LEFT_Dataset, RIGHT_Dataset,
                            LEFT.fieldName  = RIGHT.fieldName,
                            GROUP,
                            xForm(LEFT,ROWS(RIGHT)));
ValueDefinition
functionfunction that’s calling transform, such as JOIN
LEFT_DatasetLeft dataset of the join. LEFT is the first dataset passed to JOIN
RIGHT_DatasetRight dataset of the join. RIGHT is the second dataset passed to JOIN
LEFT.fieldName = RIGHT.fieldNameMatching condition
GROUPkeyword
Transform/xFormExplicit or stand-alone TRANSFORM
LEFTLeft dataset being passed to transform
ROWSKeyword
RIGHTRight dataset being passed to ROWS