Hi Alex - I have a static dropdown whose values are populated by a service and action. If the drop down has got only one item it has to auto select that item and let the user select if the drop down has got more than one items returned from the service.
-- https://imgur.com/wkdXFCq - This works fine to set the first item returned as the default value. For my scenario, In the action in addition to setting the "Selection Control Items", I set the "Control Values" using the xpath "if (count(//us-code)=1) then /countries/country[1]/us-code else ()" . This worked fine in 2018.3. In 2019.1 the static drop down value is shown empty when rendered to a pdf. Thanks Manish 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/01605abe-505d-466d-bdf8-caa0436e8f6c%40googlegroups.com. |
Administrator
|
Hi Manish,
I am a bit confused, as the Actions Editor dialog / Service Response Actions tab doesn't look as in your screenshot. In 2019.1, it looks as follows: service-resource-actions.png <http://discuss.orbeon.com/file/t119778/service-resource-actions.png> . Also, things work fine for me in that case. For reference, here is the source of the test form I created: form.xml <http://discuss.orbeon.com/file/t119778/form.xml> . Did maybe something go wrong with your update of Orbeon Forms, and you still have some older files in place? ‑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/1572555549382-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex - I used an old snapshot which was on 2018.3 Was I using the right logic? Why is the dropdown value empty in that case when rendered to pdf? On Fri, 1 Nov. 2019, 04:58 Alessandro Vernet, <[hidden email]> wrote: Hi Manish, 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/CAN39TsMT0wFo85PksdCG%2BxFbEiNRSPxaKEtD4B2HbfO9tarmDQ%40mail.gmail.com. |
Administrator
|
Hi Manish,
Got it about the dialog. About the value missing from the PDF, is this with the automatic PDF? I am also not seeing this with 2019.1 (see link below). I am missing something? Or maybe you could create a minimal example that reproduces the problem, and attach it to your response? automatic-pdf.pdf <http://discuss.orbeon.com/file/t119778/automatic-pdf.pdf> ‑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/1572562584632-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex
-- Attached the form definition. https://restcountries.eu/rest/v2/name/{name} - - this is the API I used. Type 'America' in the first field and select any country from the dropdown. You can see the value is not passed when rendered to a pdf. I noticed this happens only when we select 'appears or changes value' (attached image) control action and works fine when 'changes its value' is selected. Thanks Manish On Friday, November 1, 2019 at 6:56:00 AM UTC+8, Alessandro Vernet wrote: Hi Manish, 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/a9f1c199-2407-4a15-a4f8-bf6279235664%40googlegroups.com. Dropdown test.txt (7K) Download Attachment dropdown.PNG (21K) Download Attachment test - 0f4a9cc7c83898f9.pdf (6K) Download Attachment |
Administrator
|
Hi Manish,
I reproduce the issue, but it isn't related to the PDF, and even happens if you select a country border, save, and reload the page: then the Country Border dropdown shows empty. This is caused by your action, and specifically the "Set Control Value" expression. There, you essentially reset the field if the dropdown has more than 1 item… hence the field showing empty when you reload the page or generate the PDF. In that expression, instead of `()`, I think you want to use something like `fr:control-string-value('control-2')`, to keep the current value. action.png <http://discuss.orbeon.com/file/t119778/action.png> You'll let me know if this works for you! ‑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/1572891380811-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Thanks Alex - this works.
-- Is there a way to filter only distinct values in the dropdown even when the service is returning duplicate values. Cheers Manish On Tuesday, November 5, 2019 at 2:15:21 AM UTC+8, Alessandro Vernet wrote: Hi Manish, 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/1ba61bea-985b-4691-a1f2-7b68d6070a3f%40googlegroups.com. |
Administrator
|
Hi Manish,
I'm glad not resetting the value of the control indeed works for you as well. You can leverage `distinct-values()` for this. Try changing your choices XPath to something like: distinct-values(/json/*/name) And then set both the name and value to `.` (just a dot). You'll let me know if this works for you! ‑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/1572981078956-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Thanks Alex - works perfect!
-- It now automatically populates the value of the dropdown if the service is returning only one distinct value. How can I make this dropdown read only in this case and not read only if the drop down has got more than one items returned from the service? Cheers Manish On Wednesday, November 6, 2019 at 3:10:10 AM UTC+8, Alessandro Vernet wrote: Hi Manish, 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/50fdfe94-fde2-4e08-aa15-799c5d67c026%40googlegroups.com. |
Administrator
|
Hi Manish,
I'm glad the `distinct-values()` works. But I'm not sure what you mean by "make this dropdown read only in this case and not read only if the drop down has got more than one items returned from the service". Could clarify what you meant by that, maybe with an example? ‑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/1573081109926-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex - Please use the same example attached before.
-- If Country name is 'America' the dropdown control has got 3 choices and let's the user to select one. In another case where the country name is 'Russia' the dropdown has only one choice which is autofilled. I want the dropdown read only in this scenario as the user does not have to select any choice as it is autofilled with the logic you mentioned above. Thanks On Thursday, November 7, 2019 at 6:57:10 AM UTC+8, Alessandro Vernet wrote: Hi Manish, 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/9247134c-a698-445a-9a6f-f3414a1ca5b6%40googlegroups.com. |
Administrator
|
Hi Manish,
Got it! You can use an expression as follows, in the Control Settings, Formulas, Read-only: let $itemsetid := @fr:itemsetid, $itemset := /form/fr:metadata/itemset[@id = $itemsetid] return count($itemset/choices/item) = 1 To come up with this type of expressions, you can use the XForms Inspector to check what the form data looks like at runtime. You enable the XForms Inspector by setting the `oxf.epilogue.xforms.inspector` property to `true`, and then see the form data in the `fr-form-model` model / `fr-form-instance` instance. And you'll let me know if this works for you, ‑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/1573240689742-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Works perfect - thanks
-- On Saturday, November 9, 2019 at 3:16:33 AM UTC+8, Alessandro Vernet wrote: Hi Manish, 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/25f3aa60-54a1-45fa-8f4b-f25c49e9f8bd%40googlegroups.com. |
Administrator
|
Excellent Manish, and thank you for the update!
‑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/1573582631830-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
In reply to this post by Alessandro Vernet
Hi Alex - Using this would keep the label and value same. What if I want to use 'countryname' as label and 'currency' as value?
-- Can I use something like /json/*/ And then set both the name to `distinct-values(countryname)` and value to `distinct-values(currency)` instead as i would like to display a different On Wednesday, November 6, 2019 at 3:10:10 AM UTC+8, Alessandro Vernet wrote: Hi Manish, 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/6638e5ef-d653-4303-b645-f1ae21aa11a3%40googlegroups.com. |
Administrator
|
Hi Manish,
So you want users to select a country, and store the currency. But if you have 2 countries with the same currency, next time you load the data, what country should you show? If you stored the currency, you don't know anymore which country was selected. So it's maybe better to store the country name, and have the currency calculated in another field (and maybe hidden from users, if you just need it in the data). Would that make sense? ‑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/1573693108834-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex - You're right but that is just an example. I have a use case where I need store something like distinct-values(string-join(/json//*/countryname[not(contains(text(),'null'))],//countrycode) and use (.) for both label and value. So that I can extract the country code by substring and use it to call some other API again. Assuming I have a schema as <countryname>Brazil</countryname> <countrycode>111</countrycode>
<countryname>null-Brazil</countryname> <countrycode>1123</countrycode> <countryname>America</countryname> <countrycode>100</countrycode> <countryname>Brazil</countryname> <countrycode>111</countrycode> I must get the dropdown values as 111 - Brazil 100 - America and not have the duplicate values or those which contains text 'null' . . What is wrong that I'm doing here On Thu, Nov 14, 2019 at 8:56 AM Alessandro Vernet <[hidden email]> wrote: Hi Manish, 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/CAN39TsPNiyMbL8txi_Rt1vOstywi4x3NJ%3DhjJU9dBM4BegBtdw%40mail.gmail.com. |
In reply to this post by Alessandro Vernet
Hi Alex - You're right but that is just an example. I have a use case where I need store something like
-- distinct-values(string-join((// Assuming I have an API returning an xml: <countryname>Brazil</ <countrycode>111</countrycode> <countryname>null-Brazil</ <countrycode>1123</ <countryname>America</ <countrycode>100</countrycode> <countryname>Brazil</ <countrycode>111</countrycode> I must get the drop-down values as 111 - Brazil 100 - America and not have the duplicate values or those which contains text 'null' . . What is wrong that I'm doing here On Thursday, November 14, 2019 at 8:56:05 AM UTC+8, Alessandro Vernet wrote: Hi Manish, 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/36fd57ac-9a53-4fa2-9687-2671676131fb%40googlegroups.com. |
Administrator
|
Hi Manish,
Could you attach the actual JSON returned by your service? You're saying that you'd like to have "111 - Brazil", "100 - America", etc shown in the dropdown. And what would you like to be stored in the data? The same thing? I'm asking all those details, so I can just create, test, and share with you an example that does this. ‑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/1573776844095-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex - This is the snippet of the JSON
-- { "success":true, "message":null, "staff": {"eid":"1234", "firstName":"John", "lastName":"Blokes", "positions": [{"description":"Director - BU", "Id":"111"}, {"description":"null - Other Services", "Id":"222"}, {"description":"Director", "Id":"111"}, {"description":"null- Commercial", "Id":"333"}] } } On trigger, the dropdown must have the values as "Id - description". I need all the distinct values of description not containing 'null'. Date should be same as dropdown label. Thanks Manish On Friday, November 15, 2019 at 8:11:30 AM UTC+8, Alessandro Vernet wrote: Hi Manish, 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/63a7a086-d491-4585-9da2-8fc526d34a5a%40googlegroups.com. |
Free forum by Nabble | Edit this page |