Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using update_form on a custom form with duplicate fields #296

Open
spwoodcock opened this issue Sep 11, 2024 · 2 comments
Open

Using update_form on a custom form with duplicate fields #296

spwoodcock opened this issue Sep 11, 2024 · 2 comments
Assignees
Labels
bug Something isn't working Priority: Must have High Priority xlsform Related to modifying XLSForms

Comments

@spwoodcock
Copy link
Member

spwoodcock commented Sep 11, 2024

Describe the bug

  • We have a mandatory_fields.xlsx XLSForm.

  • If this is merged via update_forms with a custom form that contains duplicate fields, then we get some duplicate columns.

  • For example the mandatory_fields.xls contains the status field. The current buildings.xls also contains a status field.

  • When these forms are merged, we get a duplicate save_to column called save_to.1:

    image

To Reproduce

  • Run update_form.merge_sheets on buildings.xls in this repo.
  • Save the output to a file and view.

Expected behavior

  • We should warn users they have a duplicate field when running the function.
  • Ideally we return an error and ask them to rename / remove the field.
  • In the end, the mandatory forms field should take precedence.

Additional context

  • The form still works fine with the save_to.1 column.
  • This isn't high priority as it doesn't break anything (as far as I am aware).
@manjitapandey
Copy link

manjitapandey commented Jan 20, 2025

Encountered cases:
First: I have encountered forms with only label field not specifying which language is it. Its mostly seen in forms where they are not concerned more about different language and only include english as default language. This can be one of the error where fields won't be visible in odk, though its very rare.
Second: The cases where label field may include spaces label::english (en) Though its not the standard behavior, odk doesn't rise error during validation and mostly beginner tend to make this kind of error. - Handled
Third: The cases where language may include number like label::english(1). - Handled
Forth: The cases where language short form are not included like label::English - Not handled
Fifth: The cases where label field contains capital letter like label::English(en) - Handled

@spwoodcock
Copy link
Member Author

spwoodcock commented Jan 20, 2025

Thanks for investigating these!

In scenario 1, if the user doesn't care about languages and wants to set it to their device default, they will simply use label. Its not preferred over setting the language explicitly, but its possible.

However we can't identify which language they want to use, so should just select English as a default. The simplest way for us to handle that is to remove all translation columns, and update column label::english(en) to be label for the column matching.

Scenario 4 could be solvable by fuzzy matching the language name and keeping a dictionary matching language names to their two letter iso code. But to be honest, that's just user error and I dont think we should go to so much effort for it. Instead, this problem is aided when we create some sort of form builder directly in FMTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority: Must have High Priority xlsform Related to modifying XLSForms
Projects
Development

No branches or pull requests

3 participants