Autofill fields

I am currently using the cascading option for the fields district, health facility, and subcounty, and would like to know if it's possible to include the autofill option in the subcounty field so that user only needs to choose the district and health facility.

I am using ODK build: https://build.opendatakit.org/ I tried to find some syntax for the advanced section of the form, but didn't find anything. I also tried to attach the odkbuild form to this post but the options available don't allow this type of files. Thank you,

Hi Tiana,

Good to see you here!
I don't think the feature of autofill is supported on ODK. If I am not wrong the sequence is District -> Subcounty -> Health facility. Which you can easily achieve by cascading select. In case if you are experiencing any limitation with build, you may consider using XLSForm form standard to build your form. XLSForm provides more freedom for creating your form and for reference you may visit this link.

Welcome to the ODK forum, @tjaramillo! I'd encourage you to add a real picture as your avatar because it helps build community!

Thanks,
Imran

2 Likes

Hello Tiana,

It's possible to auto-fill. it might be more difficult since you are still using Build, however if you switch to XLSForm, the auto-fill can be accomplished in following steps

  • Make a CSV list with District, HF and Sub-count (only code)
    e.g. -- 101 -- District one -- 10101 -- Health Facility one -- 1010101 (This is the sub-county code)
  • Add the questions to your form, and set the Sub-country to read_only
  • In the sub-county calculation, put this formula "pulldata('a', 'b', 'c', d)" where
    a: is the fille name you gave to the CSV
    b: is the column value to return from the CSV
    c: is the corresponding look-up column from the CSV (in you case the code to the health facility)
    d: is the look-up value from user inputs (in this case the current user selection on Health F question

the final formula will look like this "pulldata('CSV_File_Name', 'Sub_county_column_header_from_csv', 'HF_Column_header from csv', ${HF_Variable_name})"

Please note that it's recommended to use CSV file as attachment to your forms when dealing with long lists of options like administrative zones

Hoping this helps
Cheers, JR

2 Likes

Thank you. We want to keep the design as simple as possible as our field teams need to be able of modifying it in the future without depending on others. XML is not an option for them, at least for now.

Hi Jules,

Is there any chance to have an example form for auto-fill? Trying to achieve something as you explained, not sure how the form and the csv should look like.

Thanks,
Imran

Hello Imran,

My apologies for a delayed response. please follow this link for the example i mentioned and do let me know if it works for you otherwise happy to work other solutions

Cheers

JR

1 Like

Dear JR,

Learned lots of new things through this example. Thanks for your time for helping on this.

Thanks again,
Imran