Search function with csv file

What is the problem? Please be detailed.

I populate list of items by using search('file_name')
In my csv file a column name DateOfValidity provide a date that i would like to use
Only if current date is before this date of validity the item should be populated

What ODK tool and version are you using? And on what device and operating system version?
Odk 1 v1.17

What steps can we take to reproduce the problem?

What you have you tried to fix the problem?
I try in the apparence column of xls form

Today dateOfTheDay
Select_one Item choose your item search('File_name','DateOfValidity','>${DateOfTheDay})

Hi @Fabienne35, if your date of validity is formatted YYYY-MM-DD then the following should work. Let me know if this helps/works!


type name label choice_filter
select_one mychoices test pick one bestby>today()


list_name name label bestby
mychoices a 2018-12-11 2018-12-11
mychoices b 2017-10-10 2017-10-10
mychoices c 2017-10-10 2017-10-10
mychoices d 2019-10-10 2019-10-10

What should I change if My choice list is in an external CSV file ?

Should I put the column label in CSV file as the name 's column in choice sheet?


The solution is not working with an external csv file for loading the filtered data
Is there a way to enter sqlite select formula in xlsform ?

I've been exploring this. And the below choice_filter with an external item set works.


type name label choice_filter
select_one yn q1 Q1 a
select_one_external mychoices q2 Q2 myfilter=${q1}


list_name name label
yn yes yes
yn no no


list_name name label myfilter
mychoices a selected yes yes
mychoices b selected no no

The ODK docs note that:

The relational operators (>, >=, <, <=) only work with numbers.

The following doesn't to work at all:


type name label choice_filter
select_one q1s q1 Q1
select_one q2s q2 Q2 myfilter>${q1}
select_one_external q3s q3 Q3 myexternalfilter>${q1}


list_name name label myfilter
q1s b b
q1s c c
q1s d d
q2s a a a
q2s b b b
q2s c c c
q2s d d d
q2s e e e


list_name name label myexternalfilter
q3s a a a
q3s b b b
q3s c c c
q3s d d d
q3s e e e


I misread how you were trying to do things and I tested the following (which isn't the path you were following):


type name label choice_filter
select_one q2s q2 Q2 decimal-date-time(today())<decimal-date-time(myfilter)
select_one_external q3s q3 Q3 decimal-date-time(today())<decimal-date-time(myexternalfilter)


list_name name label myfilter
q2s past past 2015-01-01
q2s today today 2018-10-17
q2s future future 2020-01-01


list_name name label myexternalfilter
q3s past past 2015-01-01
q3s today today 2018-10-17
q3s future future 2020-01-01

And after converting using XLSForm Offline, it gives me an itemsets.csv that looks like:


And this survey:

type name label calculation
calculate calc decimal-date-time("2020-10-17")
calculate calc2 decimal-date-time(today())
note show ${calc} ---- ${calc2}


So I would think the survey posted above that I'm testing should work, as it seems like it would be comparing numbers. But the external isn't working.

it looks like there's some issues with implementing the functionality you're trying to use (dynamic selects from pre-loaded data) as noted by @LN in this issue:

@Fabienne35 how many options are there? can you include them on the choices sheet of the form itself instead of in an external file and follow the example in my first post?

In fact the datas comes from an other software which is updated every weeks and the number of items could be huge in certains circonstance (>1000)
so I need to figure how to filter when the stock file is generated I forget having an real time filtering