Unable to hide fields in reports while using "hidden_fields"

**Description:**Unable to hide fields in reports while using “hidden_fields” in properties.json

Attachments:
hidden_fields

Hi @bindugowrig

I’ve just tested this on my local installation and I got it to work though there are a couple of tricks to it!

Firstly the hidden_fields property needs to be at the top level. It’s hard to tell from your thumbnail but it looks like it’s nested under context. For example:

{
    "icon": "icon-person",
    "title": "Undo death report",
    "context": { ... },
    "hidden_fields": ["undo"]
}

Secondly, when you run upload-app-forms you may see a warning in the console like this…

WARN Ignoring unknown properties in [filename]: hidden_fields

This warning is incorrect and should be ignored. The field should be hidden as expected. I’ve raised this issue to remove the warning. Make sure you run convert-app-forms before running upload-app-forms because it’s the convert step which applies the marks the fields as hidden.

Thirdly, please note that the field is only applied to reports submitted with the new config - it won’t apply to existing reports. So be sure to submit a new report when testing this feature.

Finally, it looks like we have no documentation for this feature so I’ve raised an issue to document how to use it!

1 Like

Thanks for the quick reply @gareth .I tried above solution and its working

hello @gareth @jkuester

i would to like hide these forms fields from appearing in the reports UI

and added this config

{
  "hidden_fields": [
    "aka_ctx",
    "tsis_ctx",
    "at_ctx",
    "yr_date_of_birth_ctx",
    "patient_date_of_birth",
    "patient_genda",
    "patient_tsis"
  ],
  "title": "Form - Labs and Medications",
  "icon": "tabs",

  "context": {
    "person": true,
    "place": false,
    "expression": "contact.type === 'person'"
  }
}

though when i run convert-app-forms and upload-app-forms respectively and then submitted a new report ,the fields still persist , not sure what i could be missing here

You seem to have the correct approach here. Can you check check your form document in Photon (in the medic db, there should be a doc with "_id": "form:your_form_name) and see if it contains the expected hidden_fields array as a root level property? If so, then we know the config change has actually made it to the server. Then, if you are using an offline user to submit reports, be sure to “Sync now” for that user to make sure they have the latest config before submitting a new report.

You could also try using the instance::tag = hidden configuration in the form xlsx itself (as mentioned in another thread) to hide the fields when on the Reports tab. That does provide more fine-grained control over which fields are hidden, but really either should still work fine.

1 Like

thanks @jkuester i do have

"doc": {
  "_id": "039b325c-3a51-4478-8cc5-c939221ba11a",
  "_rev": "1-d72b498e7b9d4cce638c1aafb9d77897",
  "form": "medication",
  "type": "data_record",
  "content_type": "xml",
  "reported_date": 1720450956985,
  "contact": {
   "_id": "6868ba20-6b1c-4323-b0fe-99d9267338ae",
   "parent": {
    "_id": "845e0796-3bd3-4df5-aade-fd4f1d1845d2"
   }
  },
  "from": "+256795571892",
  "form_version": {
   "time": 1720450777026,
   "sha256": "542173c9710859191b84afbcae66bf2fbfc0b407139275d7bc0ac214008fd12e"
  },
  "hidden_fields": [
   "patient_tsis",
   "patient_genda",
   "patient_date_of_birth",
   "aka_ctx",
   "tsis_ctx",
   "at_ctx",
   "yr_date_of_birth_ctx",
   "meta"
  ],
  "fields": {
   "inputs": {
    "meta": {
     "location": {
      "lat": "",
      "long": "",
      "error": "",
      "message": ""
     },
     "deprecatedID": ""
    },
    "source": "contact",
    "source_id": "",
    "contact": {
     "_id": "01ee269d-51a5-463c-a702-451c496be232",
     "patient_id": "87531",
     "name": "Angella Powell",
     "date_of_birth": "1990-12-01",
     "sex": "",
     "name1": "Powell",
     "aka": "Lom",
     "tsis": "6633",
     "genda": "gender_female",
     "parent": {
      "contact": {
       "phone": "+256785579890",
       "name": "Cliff Test"
      }
     }
    }
   },
   "patient_id": "87531",
   "patient_name": "Angella Powell",
   "patient_name1": "Powell",
   "patient_aka": "Lom",
   "patient_tsis": "6633",
   "patient_genda": "gender_female",
   "patient_date_of_birth": "1990-12-01",
   "fast_name_ctx": "Angella Powell",
   "last_name_ctx": "",
   "date_of_birth_ctx": "1990-12-01",
   "aka_ctx": "Lom",
   "tsis_ctx": "6633",
   "at_ctx": "female",
   "yr_date_of_birth_ctx": "34",
   "gender_ctx": "gender_female",
   "medication": {
    "first_name": "",
    "age_n": "",
    "dob": "",
    "n_special_instruction_title": "",
    "date_completed": "2024-07-02",
    "name_person": "hgggghg",
    "most_recent": "2024-07-03",
    "results": "gghghhghg",
    "recent": "2024-07-05",
    "cd_results": "ftft",
    "current_regime": "2024-07-04",
    "art_regime": "massjhioqop",
    "nots": "new notes"
   },
   "meta": {
    "instanceID": "uuid:037b0b8b-0e0f-3a6a-a352-4f55b549cfe4"
   }
  },
  "geolocation_log": [
   {
    "timestamp": 1720450956990,
    "recording": {
     "code": 1,
     "message": "User denied Geolocation"
    }
   }
  ],
  "geolocation": {
   "code": 1,
   "message": "User denied Geolocation"
  },
  "_attachments": {
   "content": {
    "content_type": "application/xml",
    "revpos": 1,
    "digest": "md5-5Y0BIbN1de8Pl2h7ou+++Q==",
    "length": 2593,
    "stub": true
   }
  }
 }
}

Okay, great! So based on that, we can see that the reports for the form are being written with the expected hidden_fields data. So, now are you still seeing the hidden fields show up for this report on the Reports tab? (If so, could you include a screen shot with the unexpected content?)

hello @jkuester sorry for the delayed response
but i had decided to use instance::tag in the xls forms as you had suggested

1 Like