External App Integration

Hi all,

Just posted to the ODK Community group as well. I'm a new developer working
with SEL at Columbia, and new to ODK and the OpenRosa ecosystem. I'm
working on an external app that will integrate with ODK Collect, and I've
been able to collect data with my external app successfully! But I do have
a few questions:

  1. I need to use a field-list group to populate multiple fields from the
    external app. Is there a way to define the intent attribute (or custom
    attributes in general) via XLSForm? Or at the moment does this need to be
    done manually in the XML?

  2. When the component specified by the intent isn't found on the device,
    the message says to enter the data manually. But with the field-list group,
    the fields don't seem to be editable... am I missing something?

  3. In the source code for ExStringWidgethttps://code.google.com/p/opendatakit/source/browse/src/org/odk/collect/android/widgets/ExStringWidget.java?repo=collect,
    it indicates that the text of the "Launch" button can be changed
    via jr:itext()... this doesn't seem to be the case for the field-list
    group, correct?

  4. I was initially hung up by the "ex:" portion of the intent attribute...
    I assumed this was an identifier used by ODK collect, but that it wouldn't
    be included in the component name for the actual Intent object ODK uses to
    start the external app. However, it was included, meaning I needed to
    include the "ex:" in the value of the intent filter action in the external
    app, or, as I ended up doing, removing it from both (i.e ). I suspect the "ex:" might
    be a holdover from the single-field versions, which use the appearance
    attribute for the intent? Not sure... any clarity on this would be
    appreciated.

Thanks in advance, and kudos for adding this feature (I was expecting I'd
have to contribute it :)... I'm sure it's going to be valuable for lots of
folks!
Jon

Hi Jonathan,

  1. XLSForm supports a certain (limited) set of attributes, so no, you
    cannot define your own ones in there. However, I believe "intent" IS one of
    them, so you can use that.

  2. You are right, for field-list groups the fields stay non-editable; it is
    just the error message that is not accurate.

  3. No, this is the same for field-list groups too (the code is in
    ODKView.java). I haven't used it before but it seems that the only thing
    you need is an attribute named "buttonText". It also seems that you can
    also change the error message in the previous bullet (3) by adding an
    attribute named "noAppErrorString".

  4. You are right, for field-list groups you don't need the "ex:" in the
    intent value, that is only meant to be in the appearance of single field
    questions.

Meletis.

··· On Thursday, May 15, 2014 9:40:46 PM UTC+3, Jonathan Wohl wrote: > > Hi all, > > Just posted to the ODK Community group as well. I'm a new developer > working with SEL at Columbia, and new to ODK and the OpenRosa ecosystem. > I'm working on an external app that will integrate with ODK Collect, and > I've been able to collect data with my external app successfully! But I do > have a few questions: > > 1) I need to use a field-list group to populate multiple fields from the > external app. Is there a way to define the intent attribute (or custom > attributes in general) via XLSForm? Or at the moment does this need to be > done manually in the XML? > > 2) When the component specified by the intent isn't found on the device, > the message says to enter the data manually. But with the field-list group, > the fields don't seem to be editable... am I missing something? > > 3) In the source code for ExStringWidget, > it indicates that the text of the "Launch" button can be changed > via jr:itext()... this doesn't seem to be the case for the field-list > group, correct? > > 4) I was initially hung up by the "ex:" portion of the intent attribute... > I assumed this was an identifier used by ODK collect, but that it wouldn't > be included in the component name for the actual Intent object ODK uses to > start the external app. However, it was included, meaning I needed to > include the "ex:" in the value of the intent filter action in the external > app, or, as I ended up doing, removing it from both (i.e ref="/facilitytest/facility" appearance="field-list" > intent="org.columbia.sel.facilitator.COLLECT">). I suspect the "ex:" might > be a holdover from the single-field versions, which use the appearance > attribute for the intent? Not sure... any clarity on this would be > appreciated. > > Thanks in advance, and kudos for adding this feature (I was expecting I'd > have to contribute it :)... I'm sure it's going to be valuable for lots of > folks! > Jon >

Thanks Meletis,

On point 1, can you point me to documentation on how to add attributes via
XLSForms, and which attributes are supported? Can't seem to find that, I'm
likely just overlooking it.

Cheers,
Jon

··· On Thursday, May 15, 2014 3:24:27 PM UTC-4, Meletis Margaritis wrote: > > Hi Jonathan, > > 1. XLSForm supports a certain (limited) set of attributes, so no, you > cannot define your own ones in there. However, I believe "intent" IS one of > them, so you can use that. > > 2. You are right, for field-list groups the fields stay non-editable; it > is just the error message that is not accurate. > > 3. No, this is the same for field-list groups too (the code is in > ODKView.java). I haven't used it before but it seems that the only thing > you need is an attribute named "buttonText". It also seems that you can > also change the error message in the previous bullet (3) by adding an > attribute named "noAppErrorString". > > 4. You are right, for field-list groups you don't need the "ex:" in the > intent value, that is only meant to be in the appearance of single field > questions. > > Meletis. > > On Thursday, May 15, 2014 9:40:46 PM UTC+3, Jonathan Wohl wrote: >> >> Hi all, >> >> Just posted to the ODK Community group as well. I'm a new developer >> working with SEL at Columbia, and new to ODK and the OpenRosa ecosystem. >> I'm working on an external app that will integrate with ODK Collect, and >> I've been able to collect data with my external app successfully! But I do >> have a few questions: >> >> 1) I need to use a field-list group to populate multiple fields from the >> external app. Is there a way to define the intent attribute (or custom >> attributes in general) via XLSForm? Or at the moment does this need to be >> done manually in the XML? >> >> 2) When the component specified by the intent isn't found on the device, >> the message says to enter the data manually. But with the field-list group, >> the fields don't seem to be editable... am I missing something? >> >> 3) In the source code for ExStringWidget, >> it indicates that the text of the "Launch" button can be changed >> via jr:itext()... this doesn't seem to be the case for the field-list >> group, correct? >> >> 4) I was initially hung up by the "ex:" portion of the intent >> attribute... I assumed this was an identifier used by ODK collect, but that >> it wouldn't be included in the component name for the actual Intent object >> ODK uses to start the external app. However, it was included, meaning I >> needed to include the "ex:" in the value of the intent filter action in the >> external app, or, as I ended up doing, removing it from both (i.e > ref="/facilitytest/facility" appearance="field-list" >> intent="org.columbia.sel.facilitator.COLLECT">). I suspect the "ex:" might >> be a holdover from the single-field versions, which use the appearance >> attribute for the intent? Not sure... any clarity on this would be >> appreciated. >> >> Thanks in advance, and kudos for adding this feature (I was expecting I'd >> have to contribute it :)... I'm sure it's going to be valuable for lots of >> folks! >> Jon >> >

Meletis,

Thanks also for the tip on point 3! In case anyone else wants to do this —
after looking at the ODKView class and reviewing the JavaRosa docs, I was
able to modify both the error message and the button text. It's a bit more
than just adding those attributes.

First, add an itext element to the model in your XML:

  <model>
    <itext>
      <translation default="" lang="English">
        <text id="yourTextID">
          <value form="buttonText">The Button Text</value>
          <value form="noAppErrorString">Sorry, an appropriate app 

could not be found.


    ... [instance, bindings]

  </model>

Then in the body, within the group element, add a label element with a ref
to the id for the text:

 <group ref="/my/groupfield" appearance="field-list" 
        intent="org.columbia.sel.facilitator.COLLECT" >
  
  <label ref="jr:itext('yourTextID')"/>

  ... [inputs]

</group>

Cheers,
Jon

··· On Thursday, May 15, 2014 3:24:27 PM UTC-4, Meletis Margaritis wrote: > > Hi Jonathan, > > 1. XLSForm supports a certain (limited) set of attributes, so no, you > cannot define your own ones in there. However, I believe "intent" IS one of > them, so you can use that. > > 2. You are right, for field-list groups the fields stay non-editable; it > is just the error message that is not accurate. > > 3. No, this is the same for field-list groups too (the code is in > ODKView.java). I haven't used it before but it seems that the only thing > you need is an attribute named "buttonText". It also seems that you can > also change the error message in the previous bullet (3) by adding an > attribute named "noAppErrorString". > > 4. You are right, for field-list groups you don't need the "ex:" in the > intent value, that is only meant to be in the appearance of single field > questions. > > Meletis. > > On Thursday, May 15, 2014 9:40:46 PM UTC+3, Jonathan Wohl wrote: >> >> Hi all, >> >> Just posted to the ODK Community group as well. I'm a new developer >> working with SEL at Columbia, and new to ODK and the OpenRosa ecosystem. >> I'm working on an external app that will integrate with ODK Collect, and >> I've been able to collect data with my external app successfully! But I do >> have a few questions: >> >> 1) I need to use a field-list group to populate multiple fields from the >> external app. Is there a way to define the intent attribute (or custom >> attributes in general) via XLSForm? Or at the moment does this need to be >> done manually in the XML? >> >> 2) When the component specified by the intent isn't found on the device, >> the message says to enter the data manually. But with the field-list group, >> the fields don't seem to be editable... am I missing something? >> >> 3) In the source code for ExStringWidget, >> it indicates that the text of the "Launch" button can be changed >> via jr:itext()... this doesn't seem to be the case for the field-list >> group, correct? >> >> 4) I was initially hung up by the "ex:" portion of the intent >> attribute... I assumed this was an identifier used by ODK collect, but that >> it wouldn't be included in the component name for the actual Intent object >> ODK uses to start the external app. However, it was included, meaning I >> needed to include the "ex:" in the value of the intent filter action in the >> external app, or, as I ended up doing, removing it from both (i.e > ref="/facilitytest/facility" appearance="field-list" >> intent="org.columbia.sel.facilitator.COLLECT">). I suspect the "ex:" might >> be a holdover from the single-field versions, which use the appearance >> attribute for the intent? Not sure... any clarity on this would be >> appreciated. >> >> Thanks in advance, and kudos for adding this feature (I was expecting I'd >> have to contribute it :)... I'm sure it's going to be valuable for lots of >> folks! >> Jon >> >

Jon,

XLSForm supports only a subset of the XForm features. There is no way to
add extra attributes, unless they're explicitly supported by XLSForm (like
"appearance") is.

To use the extra attributes, you'll need to switch to editing your forms in
XML. Or, download pyxform and modify it yourself to support whatever you
wish.

Best,

Chris

··· On Thu, May 15, 2014 at 3:58 PM, Jonathan Wohl wrote:

Thanks Meletis,

On point 1, can you point me to documentation on how to add attributes via
XLSForms, and which attributes are supported? Can't seem to find that, I'm
likely just overlooking it.

Cheers,
Jon

On Thursday, May 15, 2014 3:24:27 PM UTC-4, Meletis Margaritis wrote:

Hi Jonathan,

  1. XLSForm supports a certain (limited) set of attributes, so no, you
    cannot define your own ones in there. However, I believe "intent" IS one of
    them, so you can use that.

  2. You are right, for field-list groups the fields stay non-editable; it
    is just the error message that is not accurate.

  3. No, this is the same for field-list groups too (the code is in
    ODKView.java). I haven't used it before but it seems that the only thing
    you need is an attribute named "buttonText". It also seems that you can
    also change the error message in the previous bullet (3) by adding an
    attribute named "noAppErrorString".

  4. You are right, for field-list groups you don't need the "ex:" in the
    intent value, that is only meant to be in the appearance of single field
    questions.

Meletis.

On Thursday, May 15, 2014 9:40:46 PM UTC+3, Jonathan Wohl wrote:

Hi all,

Just posted to the ODK Community group as well. I'm a new developer
working with SEL at Columbia, and new to ODK and the OpenRosa ecosystem.
I'm working on an external app that will integrate with ODK Collect, and
I've been able to collect data with my external app successfully! But I do
have a few questions:

  1. I need to use a field-list group to populate multiple fields from the
    external app. Is there a way to define the intent attribute (or custom
    attributes in general) via XLSForm? Or at the moment does this need to be
    done manually in the XML?

  2. When the component specified by the intent isn't found on the device,
    the message says to enter the data manually. But with the field-list group,
    the fields don't seem to be editable... am I missing something?

  3. In the source code for ExStringWidgethttps://code.google.com/p/opendatakit/source/browse/src/org/odk/collect/android/widgets/ExStringWidget.java?repo=collect,
    it indicates that the text of the "Launch" button can be changed
    via jr:itext()... this doesn't seem to be the case for the field-list
    group, correct?

  4. I was initially hung up by the "ex:" portion of the intent
    attribute... I assumed this was an identifier used by ODK collect, but that
    it wouldn't be included in the component name for the actual Intent object
    ODK uses to start the external app. However, it was included, meaning I
    needed to include the "ex:" in the value of the intent filter action in the
    external app, or, as I ended up doing, removing it from both (i.e ). I suspect the "ex:"
    might be a holdover from the single-field versions, which use the
    appearance attribute for the intent? Not sure... any clarity on this would
    be appreciated.

Thanks in advance, and kudos for adding this feature (I was expecting
I'd have to contribute it :)... I'm sure it's going to be valuable for lots
of folks!
Jon

--
You received this message because you are subscribed to the Google Groups
"ODK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks Chris —

Got it. For testing it's no problem to edit the XML, but in the long run
we'll want a way to integrate our application seamlessly with XLSForm. I've
already started looking at extending pyxform, and will be working on that
in the coming weeks — it seems like having a flexible way to add extra
attributes could be useful for other applications as well.

Jon

··· On Thursday, May 15, 2014 4:02:03 PM UTC-4, Chris wrote: > > Jon, > > XLSForm supports only a subset of the XForm features. There is no way to > add extra attributes, unless they're explicitly supported by XLSForm (like > "appearance") is. > > To use the extra attributes, you'll need to switch to editing your forms > in XML. Or, download pyxform and modify it yourself to support whatever you > wish. > > Best, > > Chris > > > > On Thu, May 15, 2014 at 3:58 PM, Jonathan Wohl <j...@jonwohl.com wrote: > >> Thanks Meletis, >> >> On point 1, can you point me to documentation on how to add attributes >> via XLSForms, and which attributes are supported? Can't seem to find that, >> I'm likely just overlooking it. >> >> Cheers, >> Jon >> >> On Thursday, May 15, 2014 3:24:27 PM UTC-4, Meletis Margaritis wrote: >>> >>> Hi Jonathan, >>> >>> 1. XLSForm supports a certain (limited) set of attributes, so no, you >>> cannot define your own ones in there. However, I believe "intent" IS one of >>> them, so you can use that. >>> >>> 2. You are right, for field-list groups the fields stay non-editable; it >>> is just the error message that is not accurate. >>> >>> 3. No, this is the same for field-list groups too (the code is in >>> ODKView.java). I haven't used it before but it seems that the only thing >>> you need is an attribute named "buttonText". It also seems that you can >>> also change the error message in the previous bullet (3) by adding an >>> attribute named "noAppErrorString". >>> >>> 4. You are right, for field-list groups you don't need the "ex:" in the >>> intent value, that is only meant to be in the appearance of single field >>> questions. >>> >>> Meletis. >>> >>> On Thursday, May 15, 2014 9:40:46 PM UTC+3, Jonathan Wohl wrote: >>>> >>>> Hi all, >>>> >>>> Just posted to the ODK Community group as well. I'm a new developer >>>> working with SEL at Columbia, and new to ODK and the OpenRosa ecosystem. >>>> I'm working on an external app that will integrate with ODK Collect, and >>>> I've been able to collect data with my external app successfully! But I do >>>> have a few questions: >>>> >>>> 1) I need to use a field-list group to populate multiple fields from >>>> the external app. Is there a way to define the intent attribute (or custom >>>> attributes in general) via XLSForm? Or at the moment does this need to be >>>> done manually in the XML? >>>> >>>> 2) When the component specified by the intent isn't found on the >>>> device, the message says to enter the data manually. But with the >>>> field-list group, the fields don't seem to be editable... am I missing >>>> something? >>>> >>>> 3) In the source code for ExStringWidget, >>>> it indicates that the text of the "Launch" button can be changed >>>> via jr:itext()... this doesn't seem to be the case for the field-list >>>> group, correct? >>>> >>>> 4) I was initially hung up by the "ex:" portion of the intent >>>> attribute... I assumed this was an identifier used by ODK collect, but that >>>> it wouldn't be included in the component name for the actual Intent object >>>> ODK uses to start the external app. However, it was included, meaning I >>>> needed to include the "ex:" in the value of the intent filter action in the >>>> external app, or, as I ended up doing, removing it from both (i.e >>> ref="/facilitytest/facility" appearance="field-list" >>>> intent="org.columbia.sel.facilitator.COLLECT">). I suspect the "ex:" >>>> might be a holdover from the single-field versions, which use the >>>> appearance attribute for the intent? Not sure... any clarity on this would >>>> be appreciated. >>>> >>>> Thanks in advance, and kudos for adding this feature (I was expecting >>>> I'd have to contribute it :)... I'm sure it's going to be valuable for lots >>>> of folks! >>>> Jon >>>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "ODK Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to opendatakit-developers+unsubscribe@googlegroups.com >> . >> For more options, visit https://groups.google.com/d/optout. >> > >