Hi everyone, I don´t get feed the dynamic dropdown when I receive data from a
web service in JSON format. I can use the same service if i get xml setting the dropdown as follow: resource url: http://opendata.gijon.es/descargar.php?id=113&tipo=XML xpath expression for the node: /empresa_grupo_niveles/empresa_grupo_nivel/num_empleados xpath expression for label and value: . and to consum JSON I tried: resource url: http://opendata.gijon.es/descargar.php?id=113&tipo=JSON xpath expression for the node: /empresa_grupo_niveles or instance()/empresa_grupo_niveles neither works xpath expression for label and value: instance()/empresa_grupo_nivel/_[2] Please notice that I test with the http service that web service is working with both xml and JSON format, I think the problem is that I don't write the right xpath expression for JSON. -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. |
Ok, I got it so I will respond to myself just in case someone could have the
same doubte. The json structure is as I show below: <http://discuss.orbeon.com/file/t375607/json_structure.png> So the right Xpath expresion is: - For the node: /instance()/empresa_grupo_niveles/empresa_grupo_nivel/_[.]/num_empleados . I think one of my previous mistakes was ommit the initial '/' . And apparently if you put '.' in the array element, you get all elements of the array, then if every element is a group of elements you have to specify what of them you want to show, in my case '/num_empleados - For the value: I just wrote '.' -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Hi Vicente,
Sorry for the late response. I'm glad your persistence paid off, and you should also be able to use the following, which is a but a simpler than what you had: Choices XPath: /json/empresa_grupo_niveles/empresa_grupo_nivel/_ Label XPath: num_empleados Value XPath: num_empleados Orbeon Forms follows the rules defined in the XForms 2.0 spec to convert JSON to XML (see link below), but granted, we can't expect everyone to be familiar with those rules ;), so I think it might be useful to offer a preview that XML somewhere. We could maybe do this in the HTTP Service Editor, since we already have a Test Results tabs there. We'll need to think a little bit more about this one. https://www.w3.org/community/xformsusers/wiki/XForms_2.0#External_JSON_values Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Administrator
|
Hi Vicente,
And for reference, we've added this RFE: https://github.com/orbeon/orbeon-forms/issues/3474 Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
In reply to this post by Alessandro Vernet
Hi Alex, thanks you for the additional information.
-- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. |
In reply to this post by Alessandro Vernet
Hi Alessandro,
Thanks for you help, could you please let us know how to apply filter expression to XPATH please for example this should give me a list of all countries in Europe continent[@name='Europe']/_ many thanks Esam -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1569502017826-0.post%40n4.nabble.com. |
Administrator
|
Hi Esam,
It depends what the service returns. Would you be able to attach the XML or JSON your service returns? ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1569525888230-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Thanks Alessandro, after you answered my other post I figured out what path i
should write XPATH: /json/data/getrefdatavalues/_[RefDataSet = 'DSNReferralReason_Red']. Regards, Esam -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1569835768532-0.post%40n4.nabble.com. |
Administrator
|
Perfect, and for anyone who happens find this through a search, here is the
other thread Esam referenced: http://discuss.orbeon.com/JSONPATH-td4664735.html ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1569970184320-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |