Loading external data

hi!

replying to this post:
http://groups.google.com/group/opendatakit/browse_thread/thread/8cd52a4a7d71f253/a0807b9a1dc7a510?show_docid=a0807b9a1dc7a510

Yaw refers to this list to be more specific, and this is what I'll try
to do..

I have to display a dropdown list, filling it with changing data, in
the meaning I don't always have the same item text and therefore I
can't copy & paste it in the form definition.

The activity loading the forms knows which data has to be displayed (a
set of ids, not many) and I was wondering how could I do that. Looking
at the code, SelectOneWidget seems to be the one getting the items
within a OrderedHashtable object, and I guess it's here where I should
load my imported data. Is that right?

Also, in order to identify the select1 I want to load, I was thinking
on using the TreeElement name, which is accessible from the
WidgetFactory. We have already modified ODK, and I provide to
FormEntry a Bundle with extra data, so I could easily, from ODK, get
the select name with the data I want to show.

would that be a right way of doing it? there is a better way?

thanks in advance,

pau.

pau,

sorry about the horrible delay, been out of country.

what you are describing is what we call itemsets. i believe that code
is now in javarosa core, but we haven't exposed that in odk yet. the
idea is that you can load that potentially large set of data
statically from the form or dynamically from a database on the phone.
then we'd have a widget that allowed you to search that big list to
trim it down. if you are interested, maybe you could take the lead on
building out some of that functionality. i think we could help spec it
out.

if you need something more immediate, using the instance name seems
like the easiest way to load the data from a bundle. you could also
use that to build your own widget -- select one is not great for a lot
of options.

yaw

··· On Fri, Jun 25, 2010 at 04:41, pau wrote: > hi! > > replying to this post: > http://groups.google.com/group/opendatakit/browse_thread/thread/8cd52a4a7d71f253/a0807b9a1dc7a510?show_docid=a0807b9a1dc7a510 > > Yaw refers to this list to be more specific, and this is what I'll try > to do.. > > I have to display a dropdown list, filling it with changing data, in > the meaning I don't always have the same item text and therefore I > can't copy & paste it in the form definition. > > The activity loading the forms knows which data has to be displayed (a > set of ids, not many) and I was wondering how could I do that. Looking > at the code, SelectOneWidget seems to be the one getting the items > within a OrderedHashtable object, and I guess it's here where I should > load my imported data. Is that right? > > Also, in order to identify the select1 I want to load, I was thinking > on using the TreeElement name, which is accessible from the > WidgetFactory. We have already modified ODK, and I provide to > FormEntry a Bundle with extra data, so I could easily, from ODK, get > the select name with the data I want to show. > > would that be a right way of doing it? there is a better way? > > thanks in advance, > > pau. > >

I for one would love to see Itemsets supported now that they are available
in javarosa core. This is something that comes up all the time and would add
a tremendous utility to forms.

Neil

··· On Thu, Jul 1, 2010 at 6:23 PM, Yaw Anokwa wrote:

pau,

sorry about the horrible delay, been out of country.

what you are describing is what we call itemsets. i believe that code
is now in javarosa core, but we haven't exposed that in odk yet. the
idea is that you can load that potentially large set of data
statically from the form or dynamically from a database on the phone.
then we'd have a widget that allowed you to search that big list to
trim it down. if you are interested, maybe you could take the lead on
building out some of that functionality. i think we could help spec it
out.

if you need something more immediate, using the instance name seems
like the easiest way to load the data from a bundle. you could also
use that to build your own widget -- select one is not great for a lot
of options.

yaw

On Fri, Jun 25, 2010 at 04:41, pau pau.varela@gmail.com wrote:

hi!

replying to this post:

http://groups.google.com/group/opendatakit/browse_thread/thread/8cd52a4a7d71f253/a0807b9a1dc7a510?show_docid=a0807b9a1dc7a510

Yaw refers to this list to be more specific, and this is what I'll try
to do..

I have to display a dropdown list, filling it with changing data, in
the meaning I don't always have the same item text and therefore I
can't copy & paste it in the form definition.

The activity loading the forms knows which data has to be displayed (a
set of ids, not many) and I was wondering how could I do that. Looking
at the code, SelectOneWidget seems to be the one getting the items
within a OrderedHashtable object, and I guess it's here where I should
load my imported data. Is that right?

Also, in order to identify the select1 I want to load, I was thinking
on using the TreeElement name, which is accessible from the
WidgetFactory. We have already modified ODK, and I provide to
FormEntry a Bundle with extra data, so I could easily, from ODK, get
the select name with the data I want to show.

would that be a right way of doing it? there is a better way?

thanks in advance,

pau.

--
☞§※⌘:airplane::open_umbrella:
~Neil

ups, I haven't seen you reply until now (and I wasn't out of
country ;).. do I need to be subscribed to the list to get its
answers?

right now, since I have to deliver something this week, I went for the
instance name way, even though something is going wrong when editing
the form. The select items are loaded but the ones I pick up the first
time are not selected when I edit the form.. What I did was to modify
the PromptElement.getSelectItems() and introduce a
setSelectItems(OrderedHashtable items) method in the same class.
although it's not very nice, because is the only setter defined.

I haven't thought about creating my own widget, but what I can see is
the check:

if (prompt.getAnswerValue() != null) {
s = ((Selection) prompt.getAnswerObject()).getValue();
}

done in the SelectOneWidget doesn't give me any value, and that's why
my items are not selected.. for a quick fix, I'll try to create my own
widget. the previous developer already added an ImagePointWidget..
I'm probably missing something with the FormElementBinding when
setting the selectItems..

Anyway, if you give me some specs, I can try to do my best adding the
functionality in the right way, using javarosa core. But I guess I'll
have some troubles with the versions, because at eMOCHA we are using
an old (and slightly modified) ODK. Please let me know which versions
should I use, so I can set up my local repositories and try it out.. I
agree with Neil having this in ODK would be very helpful..

thanks and regards,

pau

ps: I also have some questions about how to suggest modifications/
additions to ODK, so we don't have to use our own ODK's branch. which
is the best place to send them?

··· On 2 Jul, 01:23, Yaw Anokwa wrote: > pau, > > sorry about the horrible delay, been out of country. > > what you are describing is what we call itemsets. i believe that code > is now in javarosa core, but we haven't exposed that in odk yet. the > idea is that you can load that potentially large set of data > statically from the form or dynamically from a database on the phone. > then we'd have a widget that allowed you to search that big list to > trim it down. if you are interested, maybe you could take the lead on > building out some of that functionality. i think we could help spec it > out. > > if you need something more immediate, using the instance name seems > like the easiest way to load the data from a bundle. you could also > use that to build your own widget -- select one is not great for a lot > of options. > > yaw > > On Fri, Jun 25, 2010 at 04:41, pau wrote: > > hi! > > > replying to this post: > >http://groups.google.com/group/opendatakit/browse_thread/thread/8cd52... > > > Yaw refers to this list to be more specific, and this is what I'll try > > to do.. > > > I have to display a dropdown list, filling it with changing data, in > > the meaning I don't always have the same item text and therefore I > > can't copy & paste it in the form definition. > > > The activity loading the forms knows which data has to be displayed (a > > set of ids, not many) and I was wondering how could I do that. Looking > > at the code, SelectOneWidget seems to be the one getting the items > > within a OrderedHashtable object, and I guess it's here where I should > > load my imported data. Is that right? > > > Also, in order to identify the select1 I want to load, I was thinking > > on using the TreeElement name, which is accessible from the > > WidgetFactory. We have already modified ODK, and I provide to > > FormEntry a Bundle with extra data, so I could easily, from ODK, get > > the select name with the data I want to show. > > > would that be a right way of doing it? there is a better way? > > > thanks in advance, > > > pau.

i'll connect you with the javarosa core folks to start working on
itemset filtering. once that is good to go, it'll be easy to add to
collect.

as far as adding changes, we prefer you create a server-side clone at
http://code.google.com/p/opendatakit/source/clones?repo=collect and
then push your changes there. when you are happy with it, send us an
email and we can review those changes and pull them into trunk.

··· On Tue, Jul 6, 2010 at 07:17, pau wrote: > ups, I haven't seen you reply until now (and I wasn't out of > country ;).. do I need to be subscribed to the list to get its > answers? > > right now, since I have to deliver something this week, I went for the > instance name way, even though something is going wrong when editing > the form. The select items are loaded but the ones I pick up the first > time are not selected when I edit the form.. What I did was to modify > the PromptElement.getSelectItems() and introduce a > setSelectItems(OrderedHashtable items) method in the same class. > although it's not very nice, because is the only setter defined. > > I haven't thought about creating my own widget, but what I can see is > the check: > > if (prompt.getAnswerValue() != null) { > s = ((Selection) prompt.getAnswerObject()).getValue(); > } > > done in the SelectOneWidget doesn't give me any value, and that's why > my items are not selected.. for a quick fix, I'll try to create my own > widget. the previous developer already added an ImagePointWidget.. > I'm probably missing something with the FormElementBinding when > setting the selectItems.. > > Anyway, if you give me some specs, I can try to do my best adding the > functionality in the right way, using javarosa core. But I guess I'll > have some troubles with the versions, because at eMOCHA we are using > an old (and slightly modified) ODK. Please let me know which versions > should I use, so I can set up my local repositories and try it out.. I > agree with Neil having this in ODK would be very helpful.. > > thanks and regards, > > pau > > ps: I also have some questions about how to suggest modifications/ > additions to ODK, so we don't have to use our own ODK's branch. which > is the best place to send them? > > On 2 Jul, 01:23, Yaw Anokwa wrote: >> pau, >> >> sorry about the horrible delay, been out of country. >> >> what you are describing is what we call itemsets. i believe that code >> is now in javarosa core, but we haven't exposed that in odk yet. the >> idea is that you can load that potentially large set of data >> statically from the form or dynamically from a database on the phone. >> then we'd have a widget that allowed you to search that big list to >> trim it down. if you are interested, maybe you could take the lead on >> building out some of that functionality. i think we could help spec it >> out. >> >> if you need something more immediate, using the instance name seems >> like the easiest way to load the data from a bundle. you could also >> use that to build your own widget -- select one is not great for a lot >> of options. >> >> yaw >> >> On Fri, Jun 25, 2010 at 04:41, pau wrote: >> > hi! >> >> > replying to this post: >> >http://groups.google.com/group/opendatakit/browse_thread/thread/8cd52... >> >> > Yaw refers to this list to be more specific, and this is what I'll try >> > to do.. >> >> > I have to display a dropdown list, filling it with changing data, in >> > the meaning I don't always have the same item text and therefore I >> > can't copy & paste it in the form definition. >> >> > The activity loading the forms knows which data has to be displayed (a >> > set of ids, not many) and I was wondering how could I do that. Looking >> > at the code, SelectOneWidget seems to be the one getting the items >> > within a OrderedHashtable object, and I guess it's here where I should >> > load my imported data. Is that right? >> >> > Also, in order to identify the select1 I want to load, I was thinking >> > on using the TreeElement name, which is accessible from the >> > WidgetFactory. We have already modified ODK, and I provide to >> > FormEntry a Bundle with extra data, so I could easily, from ODK, get >> > the select name with the data I want to show. >> >> > would that be a right way of doing it? there is a better way? >> >> > thanks in advance, >> >> > pau.