Service and Actions on Repeatable Sections

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Service and Actions on Repeatable Sections

bruno.buzzi
Hi,

The form has an HTTP service that take an argument from a Orbeon Form
component (a combo box) and then display the result in another component.

So far for god ! no problems here...

But inside a Repeatable Section the value passed to the service is always of
the first combo box iteration.

It is possible by hand to set the iteration of the argument and the
component to set ?
<xf:action class="fr-set-control-value-action">
    <xf:var name="control-name" value="'myComboField'"/>
   <xf:var name="control-value" value="/conversion/tepValue"/>
</xf:action>

"myComboField" is inside a repeatable section so i need to pass the value of
the corresponding iteration.
The same goes to the receptor of the service response.

Maybe this is relate to:
https://github.com/orbeon/orbeon-forms/issues/1298

I'm not try to fill a repeat with the result of a service but take the
correct value (iteration) from a repeatable section to call a service and
the set the corresponding values with the service result.

regards,
bruno



--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1557232172861-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

Alessandro  Vernet
Administrator
Hi Bruno,

What triggers the service to run? If something inside a "row" (e.g. a button
inside that row, or value change for a control in that row), then the value
of the control on the "current row" should be sent to the service.

‑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].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1557270017208-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

bruno.buzzi
Alex,

A value change trigger the call to the service.

But the field that trigger the call is inside a Repeatable Section.

So the service is called always with the value of the first section
iteration.

The resource url of the service is:
http://myIP:8787/orbeon-gemstone-api/conversionfuenteenergia?fuente={fr:control-string-value('field-1')}&precio={fr:control-string-value('field-2')}&consumo={fr:control-string-value('field-3')}

I think the problem is here, {fr:control-string-value('field-1')} always is
set with the value of the first iteration of 'field-1'.

After solving this i'm not sure how to tell the Action the index of the
field to set ...

regards,
bruno

--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1557518723016-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

Alessandro  Vernet
Administrator
Hi Bruno,

Is this a GET request you're doing to that URL? If so, I'd recommend you
have the action pass the values to the service, instead of putting them on
the URL manually as part of the service declaration. This way, the action
will automatically take care of passing the value of the control on the
"current row". Also see the "Passing URL parameters to GET and DELETE
methods" section on the page linked below. You'll let me know if this works
for you.

https://doc.orbeon.com/form-builder/advanced/services-and-actions/actions

‑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].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1557858011931-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

bruno.buzzi
Alex,

FIXED after:
1- Changing my service to be POST
2- Setting "Passing parameters to the service's XML request" in Orbeon
3- Put XPath in actions to point to 2)

Thanks for the pointer !

regards,
bruno

--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1558386127553-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

Alessandro  Vernet
Administrator
Perfect Bruno, I'm glad it worked and you were able to pass the values of the
"current iteration". 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 post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1558464080953-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

mbojja
Hi Alex, I'm trying to do something similar and it does not work for me. I cannot do the POST method as my rest service do not accept it. 

Tried using an action to set the URL parameters for a GET request. 

Steps I did - 

1.Create http service
* enter the resource url
* Method - GET
* Serialisation - HTML form
* URL parameters - employeeid in first column first row and left blank in second column first row (the value of this emplyee id is set from the control in the repeated grid)
2. Create action
* run action when 'employeeId' control changes its value
* call created http service
* set service request values - control 'employeeId' and xpath - '/request/employeeid '
* and response to the respective controls in the same iteration

It does not give any response. Also tested the http service using the test button in HTTP service editor by entering a sample employeeid in the url parameters section -> receives a resource error. It works when I pass the same value in the url and test it it works and returns a response.

Need help in setting the get request parameter from the repeated grid control?

On Wednesday, May 22, 2019 at 2:41:22 AM UTC+8, Alessandro Vernet wrote:
Perfect Bruno, I'm glad it worked and you were able to pass the values of the
"current iteration". And thank you for the update.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: <a href="http://discuss.orbeon.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;">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/7c90b3d6-bef7-4580-b5f0-29311d5f9edc%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

Alessandro  Vernet
Administrator
Hi Bojja,

Those issues are always a bit tricky to debug for us here if we can't access
your service, as we can't reproduce the issue locally. Could you:

1. Provide screenshots of your HTTP Service dialog, Action dialog, and the
section of the form where the control is?
2. So we have more information in the log, could you please try to set your
logging as described in the Development configuration section of the XForms
Logging page, stop your server, remove the `orbeon.log`, restart the server,
reproduce the error you're getting when you press the test button and attach
the `orbeon.log` you get?

https://doc.orbeon.com/configuration/advanced/xforms-logging.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/1568244314629-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

Alessandro  Vernet
Administrator
Hi Bojja, did you get your service and action to work? If not, and if this is
still on your front-burner, would you be able to share with us the
screenshots and `orbeon.log` per my previous message?

‑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/1568829710628-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

mbojja
Hi Alex - attached as requested. This is still a bummer!

On Thursday, September 19, 2019 at 2:01:52 AM UTC+8, Alessandro Vernet wrote:
Hi Bojja, did you get your service and action to work? If not, and if this is
still on your front-burner, would you be able to share with us the
screenshots and `orbeon.log` per my previous message?

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: <a href="http://discuss.orbeon.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;">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/2d366770-aa0b-4afb-8b5a-9a825de2ad80%40googlegroups.com.

Orbeon log.rar (169K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

Alessandro  Vernet
Administrator
Hi Bojja,

Thank you for the screenshots and the log.

The service that seems to be causing a problem is `getCancellationDetails`.
In the `orbeon.log` you attached, I am not seeing the service being called.
If you look at the logs on the service side, does it look like Orbeon Forms
calls it when the value of "Employee ID" is changed?

Also, does the service call work when you trigger it from Form Builder with
the Test button in the "HTTP Service Editor" dialog? What is the result in
the Test Results tab?

‑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/1569025549082-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

mbojja
Hi Alex- that's the service which is failing. I do not see it being called when testing the form by changing the values.

Testing using the dialog returns a resource error if the service is called using the GET parameters (Image attached)

Thanks

On Saturday, September 21, 2019 at 8:25:50 AM UTC+8, Alessandro Vernet wrote:
Hi Bojja,

Thank you for the screenshots and the log.

The service that seems to be causing a problem is `getCancellationDetails`.
In the `orbeon.log` you attached, I am not seeing the service being called.
If you look at the logs on the service side, does it look like Orbeon Forms
calls it when the value of "Employee ID" is changed?

Also, does the service call work when you trigger it from Form Builder with
the Test button in the "HTTP Service Editor" dialog? What is the result in
the Test Results tab?

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: <a href="http://discuss.orbeon.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;">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/c28aec0e-924c-475f-9a0a-2777c8be60cb%40googlegroups.com.

Test.PNG (36K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

Alessandro  Vernet
Administrator
Hi Bojja,

From that screenshot, it doesn't seem that your service is returning XML or
JSON, which is expected by Orbeon Forms and would explain the error you are
getting when running this service, or am I reading this incorrectly?

‑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/1569277131079-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

mbojja
Hi Alex - the service returns a JSON payload. It returns a response when I use the parameters in the resource url instead of passing them through the URL parameters section in the HTTP service editor.

If it is not a repeat section I could have used  fr:control-string-value('control') which returns a response with no issue. So, I would say the service only fails when adding the parameters under URL parameters section.

Thanks
Manish

On Tuesday, September 24, 2019 at 6:18:52 AM UTC+8, Alessandro Vernet wrote:
Hi Bojja,

From that screenshot, it doesn't seem that your service is returning XML or
JSON, which is expected by Orbeon Forms and would explain the error you are
getting when running this service, or am I reading this incorrectly?

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: <a href="http://discuss.orbeon.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;">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/93eb1ffa-366e-4e5c-8c6d-93db810d06ad%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

Alessandro  Vernet
Administrator
Hi Manish,

In your screenshot, it seems that the service call failed, as the tab is
red. Is the the symptom of a problem, or were the correct parameters just
not passed in this case? If the latter, we would need to have some code the
reproduces the problem you're seeing to be able to help; would you Would you
be able to create a minimal example that reproduces the problem, that we can
run here, and attach it a response so we can look into it?

‑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/1569818174873-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Service and Actions on Repeatable Sections

Alessandro  Vernet
Administrator
Hi Manish, did you get a chance to check if the tab showing in red was a
symptom of a problem with the service call?

‑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/1570210757892-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet