Using instance() and pulldata() function

Dear community,

Before I get into my issue, is it possible to use instance() and pulldata() for the same TEXT, as I have switched from an old server to a new one? I am not even able to check the pulldata function whenever I insert my pulldata function into the XLS and deploy the form, it does not get replaced. am facing couple of issues regarding this form

thank you in advance

Welcome back to the community, @alpha! The only thing you will need to be careful with is:

  • The expressions you have used for the pulldata function and the instance function.
  • Whether you have uploaded your CSV file properly under the Settings > Media Tab of your project.

Thank you. @Kal_Lam I have uploaded my CSV file into the media tab, but the data pulling isn’t working with the instance. and i have checked all my functions for my pull data, but i cant seem to get the hang of it in the calculation cell by adding the two arguments together.

Yes, you can use either the pulldata() function or direct XPath instance() lookups to get data out of the same CSV file attached to your form (or multiple files, if that is the case).

This is a simple example form that has both:

pulldata.xlsx (9.3 KB)

This is the associated CSV data file:

fruits.csv (70 Bytes)

As you can see, both have the same result (looking up the name assoiated with the key ‘mango’)

Try (for my example):

concat(${fruit_pull}, “ is the same result as ”, ${fruit_instance})

Which function is better? And what are the differences, please, between the pulldata() function or direct XPath instance() lookups

Generally speaking pulldata() will be faster for large dataset that are already CSVs, because it uses an actual database (in KoboCollect) underneath the covers. Otherwise, there are no real functional differences per se; both can be used to lookup data from external CSV datasets [whereas instance() can also lookup data from say GeoJSON files too, and lets you do fancier XPath filtering if you want to get really creative].

See Difference or use of 'pulldata' and 'instance' - #2 by LN - Support - ODK Forum

You might also read up on both in the XLSForm spec docs: XLSForm Docs