(self, document, row_number, split_columns=False,
                 transform_dates=False, as_json=False)
return rows
Return a list of ExportRows generated for the given document.
        :param document: dictionary representation of a form submission or case
        :param row_number: number indicating this documents index in the sequence of all documents in the export
        :param as_json: optional parameter, mainly used in APIs, to spit out
                        the data as a json-ready dict
        :return: List of ExportRows
Return a list of ExportRows generated for the given document.
        :param document: dictionary representation of a form submission or case
        :param row_number: number indicating this documents index in the sequence of all documents in the export
        :param as_json: optional parameter, mainly used in APIs, to spit out
                        the data as a json-ready dict
        :return: List of ExportRows
Return a list of ExportRows generated for the given document . : param document : dictionary representation of a form submission or case : param row_number : number indicating this documents index in the sequence of all documents in the export : param as_json : optional parameter mainly used in APIs to spit out the data as a json - ready dict : return : List of ExportRows
def get_rows(self, document, row_number, split_columns=False,
                 transform_dates=False, as_json=False):
        """
        Return a list of ExportRows generated for the given document.
        :param document: dictionary representation of a form submission or case
        :param row_number: number indicating this documents index in the sequence of all documents in the export
        :param as_json: optional parameter, mainly used in APIs, to spit out
                        the data as a json-ready dict
        :return: List of ExportRows
        """
        document_id = document.get('_id')

        sub_documents = self._get_sub_documents(document, row_number, document_id=document_id)

        domain = document.get('domain')

        assert domain is not None, 'Form or Case must be associated with domain'
        assert document_id is not None, 'Form or Case must have an id'

        rows = []
        for doc_row in sub_documents:
            doc, row_index = doc_row.doc, doc_row.row

            row_data = {} if as_json else []
            col_index = 0
            skip_excel_formatting = []
            for col in self.selected_columns:
                val = col.get_value(
                    domain,
                    document_id,
                    doc,
                    self.path,
                    row_index=row_index,
                    split_column=split_columns,
                    transform_dates=transform_dates,
                )
                if as_json:
                    for index, header in enumerate(col.get_headers(split_column=split_columns)):
                        if isinstance(val, list):
                            row_data[header] = "{}".format(val[index])
                        else:
                            row_data[header] = "{}".format(val)
                elif isinstance(val, list):
                    row_data.extend(val)

                    # we never want to auto-format RowNumberColumn
                    # (always treat as text)
                    next_col_index = col_index + len(val)
                    if isinstance(col, RowNumberColumn):
                        skip_excel_formatting.extend(
                            list(range(col_index, next_col_index))
                        )
                    col_index = next_col_index
                else:
                    row_data.append(val)

                    # we never want to auto-format RowNumberColumn
                    # (always treat as text)
                    if isinstance(col, RowNumberColumn):
                        skip_excel_formatting.append(col_index)
                    col_index += 1
            if as_json:
                rows.append(row_data)
            else:
                rows.append(ExportRow(
                    data=row_data,
                    hyperlink_column_indices=self.get_hyperlink_column_indices(split_columns),
                    skip_excel_formatting=skip_excel_formatting
                ))
        return rows
def get_rows ( self , document , row_number , split_columns = False , transform_dates = False , as_json = False ) : document_id = document . get ( '_id' ) sub_documents = self . _get_sub_documents ( document , row_number , document_id = document_id ) domain = document . get ( 'domain' ) assert domain is not None , 'Form or Case must be associated with domain' assert document_id is not None , 'Form or Case must have an id' rows = [ ] for doc_row in sub_documents : doc , row_index = doc_row . doc , doc_row . row row_data = { } if as_json else [ ] col_index = 0 skip_excel_formatting = [ ] for col in self . selected_columns : val = col . get_value ( domain , document_id , doc , self . path , row_index = row_index , split_column = split_columns , transform_dates = transform_dates , ) if as_json : for index , header in enumerate ( col . get_headers ( split_column = split_columns ) ) : if isinstance ( val , list ) : row_data [ header ] = "{}" . format ( val [ index ] ) else : row_data [ header ] = "{}" . format ( val ) elif isinstance ( val , list ) : row_data . extend ( val ) # we never want to auto-format RowNumberColumn # (always treat as text) next_col_index = col_index + len ( val ) if isinstance ( col , RowNumberColumn ) : skip_excel_formatting . extend ( list ( range ( col_index , next_col_index ) ) ) col_index = next_col_index else : row_data . append ( val ) # we never want to auto-format RowNumberColumn # (always treat as text) if isinstance ( col , RowNumberColumn ) : skip_excel_formatting . append ( col_index ) col_index += 1 if as_json : rows . append ( row_data ) else : rows . append ( ExportRow ( data = row_data , hyperlink_column_indices = self . get_hyperlink_column_indices ( split_columns ) , skip_excel_formatting = skip_excel_formatting ) ) return rows