Making into more rows if any value in the column has two or more values

Thulasireddy1
Tera Contributor

Can anyone explain how to split the row into multiple rows if any column has multiple values.Find the problem in the attachment #Reports #Splittingthemultiplevaluecells

 

splitting the values in the district column into two rows with remaining same column values and the district vaue should be changed

 

Splitting the values.png

 

3 REPLIES 3

Mark Manders
Mega Patron

What kind of field is 'District'? Is it a list field, referencing another field, or just a string field?

And what do you mean with 'district value should be changed'?


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

the district field is just a string filed, if it has multiple values i.e values separated by comma then other value should come in next row with the same remaining fields

Mark Manders
Mega Patron

Your report will show it like it is in the field and you can't put formatting on it there. You will need to change the formatting of the field itself. You can write a business rule like below, trigger it on 'district contains ', ':

(function executeRule(current, previous /*null when async*/) {
    if (current.u_district) {
        // Split the string by comma and join with a newline character
        var districtArray = current.u_district.split(',');
        var formattedDistrict = districtArray.join('\n');
        current.u_district = formattedDistrict;
    }
})(current, previous);

Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark