Integration Toolkit Solutions Wiki

Adding styling to a table row where a cell equals a value

From this OP, this expression uses a dataset to populate a Table and applies styling to the row in the dataset where the column Prod. Order No equals the value in the tag {[default]IGBT_ROBOT_CELL_PROD/OrderNumber}

transform(
    {[default]IGBT_ROBOT_CELL_PROD/OrderNumber},
    forEach(
        {[default]IGBT_ROBOT_CELL_PROD/SAP_RES_Dataset},
        if(
            it()['Prod. Order No'] = value(),
            asMap(
                forEach(
                    it(), // key/value pairs of the row
                    it()[0], // column key
                    asMap(
                        'value', asMap(it()[1]), // column value nested
                        'style', asMap('backgroundColor', '#ff3333')
                    )
                )
            ),
            asMap(it()) // optimized unstyled conversion of a whole row
        )
    )
)

Phil: Compare to the simply jsonification shown in comment #2.

3 Likes