# Search CSV multiple columns

**URL:** <https://forum.getodk.org/t/search-csv-multiple-columns/4189>\
**Category:** Support\
**Created:** [April 7, 2015, 12:55pm UTC](https://forum.getodk.org/t/search-csv-multiple-columns/4189 "2015-04-07T12:55:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ayub](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ayub/32/17023_2.png) [@Ayub](https://forum.getodk.org/u/Ayub)\
**Post date:** [April 7, 2015, 12:55pm UTC](https://forum.getodk.org/t/search-csv-multiple-columns/4189/1 "2015-04-07T12:55:00Z")

</div>

Hi ODK,

Is it possible to search CSV file by providing search criteria for multiple  
columns?

Like for single column we go something like :

appearance="search('csvfilename', 'matches', 'col1',/data/val1)"

So how would we further filter data down for two or multiple columns?  
something similar to " AND " as in SQL.

e,g:

appearance="search('csvfilename', 'matches', 'col1',/data/val1) and search('csvfilename',  
'matches', 'col2',/data/val2)"

Thanks for all the help.

Ayub

---

<div class="post-metadata">

**Author:** ![crobert](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/crobert/32/1613_2.png) [@crobert](https://forum.getodk.org/u/crobert)\
**Post date:** [April 7, 2015, 1:13pm UTC](https://forum.getodk.org/t/search-csv-multiple-columns/4189/2 "2015-04-07T13:13:47Z")

</div>

Ayub,

I don't believe that this is possible. The general strategy is just to  
combine the columns in your .csv file, then concatenate the proper search  
string using the concat() function in your form. It requires a bit of  
planning (to have the data organized in the right combinations in your .csv  
file), but it should be easy enough to implement.

Best,

Chris

> **···**
>
> On Tue, Apr 7, 2015 at 8:55 AM Ayub wrote:
> 
> > Hi ODK,
> > 
> > Is it possible to search CSV file by providing search criteria for  
> > multiple columns?
> > 
> > Like for single column we go something like :
> > 
> > appearance="search('csvfilename', 'matches', 'col1',/data/val1)"
> > 
> > So how would we further filter data down for two or multiple columns?  
> > something similar to " AND " as in SQL.
> > 
> > e,g:
> > 
> > appearance="search('csvfilename', 'matches', 'col1',/data/val1) and search('csvfilename',  
> > 'matches', 'col2',/data/val2)"
> > 
> > Thanks for all the help.
> > 
> > Ayub
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ayub](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ayub/32/17023_2.png) [@Ayub](https://forum.getodk.org/u/Ayub)\
**Post date:** [April 8, 2015, 6:02am UTC](https://forum.getodk.org/t/search-csv-multiple-columns/4189/3 "2015-04-08T06:02:06Z")

</div>

Chris,

That worked really well, simple and elegant solution!

Thanks!

> **···**
>
> On Tuesday, April 7, 2015 at 6:13:49 PM UTC+5, Christopher Robert wrote: \> \> Ayub, \> \> I don't believe that this is possible. The general strategy is just to \> combine the columns in your .csv file, then concatenate the proper search \> string using the concat() function in your form. It requires a bit of \> planning (to have the data organized in the right combinations in your .csv \> file), but it should be easy enough to implement. \> \> Best, \> \> Chris \> \> On Tue, Apr 7, 2015 at 8:55 AM Ayub \<nrspag...@gmail.com \> wrote: \> \>\> Hi ODK, \>\> \>\> Is it possible to search CSV file by providing search criteria for \>\> multiple columns? \>\> \>\> Like for single column we go something like : \>\> \>\> \>\> appearance="search('csvfilename', 'matches', 'col1',/data/val1)" \>\> \>\> So how would we further filter data down for two or multiple columns? \>\> something similar to " AND " as in SQL. \>\> \>\> e,g: \>\> \>\> appearance="search('csvfilename', 'matches', 'col1',/data/val1) and search('csvfilename', \>\> 'matches', 'col2',/data/val2)" \>\> \>\> Thanks for all the help. \>\> \>\> Ayub \>\> \>\> -- \>\> -- \>\> Post: opend...@googlegroups.com \>\> Unsubscribe: opendatakit...@googlegroups.com \>\> Options: http://groups.google.com/group/opendatakit?hl=en \>\> \>\> --- \>\> You received this message because you are subscribed to the Google Groups \>\> "ODK Community" group. \>\> To unsubscribe from this group and stop receiving emails from it, send an \>\> email to opendatakit...@googlegroups.com . \>\> For more options, visit https://groups.google.com/d/optout. \>\> \>
