(self, is_multiselect_chart_report, multiselect_field=None)
Return the base_item_expression for the DataSourceConfiguration.
        Normally this is {}, but if this is a data source for a chart report that is aggregated by a multiselect
        question, then we want one row per multiselect answer.
        :param is_multiselect_chart_report: True if the data source will be used for a chart report aggregated by
            a multiselect question.
        :param multiselect_field: The field that the multiselect aggregated report is aggregated by.
        :return: A base item expression.
Return the base_item_expression for the DataSourceConfiguration.
        Normally this is {}, but if this is a data source for a chart report that is aggregated by a multiselect
        question, then we want one row per multiselect answer.
        :param is_multiselect_chart_report: True if the data source will be used for a chart report aggregated by
            a multiselect question.
        :param multiselect_field: The field that the multiselect aggregated report is aggregated by.
        :return: A base item expression.
Return the base_item_expression for the DataSourceConfiguration . Normally this is {} but if this is a data source for a chart report that is aggregated by a multiselect question then we want one row per multiselect answer . : param is_multiselect_chart_report : True if the data source will be used for a chart report aggregated by a multiselect question . : param multiselect_field : The field that the multiselect aggregated report is aggregated by . : return : A base item expression .
def base_item_expression(self, is_multiselect_chart_report, multiselect_field=None):
        """
        Return the base_item_expression for the DataSourceConfiguration.
        Normally this is {}, but if this is a data source for a chart report that is aggregated by a multiselect
        question, then we want one row per multiselect answer.
        :param is_multiselect_chart_report: True if the data source will be used for a chart report aggregated by
            a multiselect question.
        :param multiselect_field: The field that the multiselect aggregated report is aggregated by.
        :return: A base item expression.
        """
        if not is_multiselect_chart_report:
            return {}
        else:
            assert multiselect_field, "multiselect_field is required if is_multiselect_chart_report is True"

            property = self.data_source_properties[multiselect_field]
            path = ['form'] + property.get_source()['value'].split('/')[2:]
            choices = [c['value'] for c in property.get_source()['options']]

            def sub_doc(path):
                if not path:
                    return {"type": "property_name", "property_name": "choice"}
                else:
                    return {
                        "type": "dict",
                        "properties": {
                            path[0]: sub_doc(path[1:])
                        }
                    }

            return {
                "type": "map_items",
                "items_expression": {
                    "type": "iterator",
                    "expressions": [
                        {
                            "type": "dict",
                            "properties": {
                                "choice": c,
                                "doc": {"type": "identity"}
                            }
                        }
                        for c in choices
                    ],
                    "test": {
                        "type": "boolean_expression",
                        "expression": {
                            "type": "property_path",
                            "property_path": ["doc"] + path
                        },
                        "operator": "in_multi",
                        "property_value": {"type": "property_name", "property_name": "choice"}
                    }
                },
                "map_expression": sub_doc(path)
            }
def base_item_expression ( self , is_multiselect_chart_report , multiselect_field = None ) : if not is_multiselect_chart_report : return { } else : assert multiselect_field , "multiselect_field is required if is_multiselect_chart_report is True" property = self . data_source_properties [ multiselect_field ] path = [ 'form' ] + property . get_source ( ) [ 'value' ] . split ( '/' ) [ 2 : ] choices = [ c [ 'value' ] for c in property . get_source ( ) [ 'options' ] ] def sub_doc ( path ) : if not path : return { "type" : "property_name" , "property_name" : "choice" } else : return { "type" : "dict" , "properties" : { path [ 0 ] : sub_doc ( path [ 1 : ] ) } } return { "type" : "map_items" , "items_expression" : { "type" : "iterator" , "expressions" : [ { "type" : "dict" , "properties" : { "choice" : c , "doc" : { "type" : "identity" } } } for c in choices ] , "test" : { "type" : "boolean_expression" , "expression" : { "type" : "property_path" , "property_path" : [ "doc" ] + path } , "operator" : "in_multi" , "property_value" : { "type" : "property_name" , "property_name" : "choice" } } } , "map_expression" : sub_doc ( path ) }