If you do not use this function with extra care you can easily corrupt the integrity of your data set. In a nutshell use row.record.cells[columnName].value[0] to fill down data within the same record.
In the following example, we have a set of languages attached to some cities and data. We are working in a records mode where different cities share the same languages. Please note the same some language does not have data attached (ie Azerbaijani, Bengali and Croatian.)
In our case, we want to have on every row to carry the language and the data attached to the city. At the first try we might want to use the fill down function:
As explained at the top of this post, fill down function really fill down all blank cells until the next one with content and does not take into account the notion of records. Our data get all mixed up:
Rollback your project using the history tab. Now we see the danger of using the fill down, we will use the function:
row.record.cells[columnName].value[0]
The Error: java.lang.ArrayIndexOutOfBoundsException: 0 indicates that there is no value to fill down for this cell. In this case, this is the records matching Azerbaijani and Bengali, which is normal.
This function recognized different records based on the first column and fill down only value within a record. This allows us to have a clean fill down and not having Arabic data going down to Azerbaijani and Bengali rows! When using the row.record.cells function make sure to that:
- You have clearly identified your records using the first column ;
- You fill down the first column only at the end, once you took care of all the others.
based on Mekk's comment on the merge records article.