diff --git a/commcare_export/env.py b/commcare_export/env.py index b885a696..df2567a4 100644 --- a/commcare_export/env.py +++ b/commcare_export/env.py @@ -346,7 +346,10 @@ def count_selected(val): def join(*args): args = [unwrap_val(arg)for arg in args] - return args[0].join(args[1:]) + try: + return args[0].join(args[1:]) + except TypeError: + return '""' @unwrap('val') diff --git a/tests/test_excel_query.py b/tests/test_excel_query.py index 3176ef89..60104859 100644 --- a/tests/test_excel_query.py +++ b/tests/test_excel_query.py @@ -208,6 +208,9 @@ def test_compile_mapped_field(self): expression = compile_mapped_field({'a': 'mapped from a'}, Reference('foo.baz')) assert list(expression.eval(env))[0].value == 'b' + expression = compile_mapped_field({'a': 'mapped from a'}, Reference('foo.boo')) + assert list(expression.eval(env)) == [] + def test_get_queries_from_excel(self): minilinq = Bind('checkpoint_manager', Apply(Reference('get_checkpoint_manager'), Literal(["Forms"])), Emit(