Medic-collect version and supported functions

I am using functions such as translate and selected-at in my xlsx form and when I opened the form in medic-collect, it seems like these functions aren’t supported.

How do I know which functions are supported and which ones are not? Also, is there a plan to upgrade medic-collect to support these new functions? In the meantime, what are other alternatives?

Hello @iesmail
Could you please elaborate what you mean by “not supported”? What is happening when you open your form?
I’m asking because I found a very old commit in medic-collect that mentioned support of selected-at (issue 846 - updated logic for selected-at() · medic/medic-collect@a4fccf8 · GitHub).

With the translate function, I got a pop which said that it’s not supported. Then I removed it and only used selected-at. I did not get any error but I also did not see the values that were supposed to be fetched by selected-at. I then ran the same form in CHT and I was able see the values.

Thank you for the feedback.

Indeed translate seems to not be supported. I’ll try to find out more about that.

However, I find that selected-at works as expected. I’m using this simple form:

<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
  <h:head>
    <h:title>collect_new - Demo Form</h:title>

    <model>
      <instance>
        <collect_new id="collect_new">
          <selected/>
          <meta>
            <instanceID/>
          </meta>
        </collect_new>
      </instance>    
      <bind nodeset="/collect_new/selected" calculate="selected-at('a b c d e', 1)" type="string"/>
    </model>
  </h:head>
  <h:body>
    <input ref="/collect_new/selected">
      <label>selected field</label>
    </input>
  </h:body>
</h:html>

And the field value is correct (b).

Regarding the translate function, it looks like it was added quite recently (2019) to the javarosa library: Add XPath translate() function (#395) · getodk/javarosa@1e57b99 · GitHub while medic-collect uses a version from at least 6 years ago.

1 Like

I can confirm that medic-collect will not receive an update to use the latest version of the Javarosa library. The project is now in maintenance mode, where it stops receiving features and updates, except for critical bug fixes.

2 Likes