Resource url

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

Resource url

mbojja
Hi Alex - Is it possible to change the resource url of a dynamic dropdown based on if-else condition.

<fr:databound-select1 xmlns="http://orbeon.org/oxf/xml/form-builder"
                                                  xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
                                                  id="control-4-control"
                                                  bind="control-4-bind"
                                                  appearance="search"
                                                  resource="if(count(for $x in tokenize($fr-search-value,'\s')) !=1) then https://www.google.com else https://www.google.co.in
                                                  ref=""
                                                  service-performs-search="true"
                                                  service-supports-paging="false"
                                                  is-last-page="">
                                <xf:label ref="$form-resources/control-4/label"/>
                                <xf:hint ref="$form-resources/control-4/hint"/>
                                <xf:alert ref="$fr-resources/detail/labels/alert"/>                        
                                <xf:itemset ref="">
                                    <xf:label ref=""/>
                                    <xf:value ref=""/>
                                </xf:itemset>
                            </fr:databound-select1>

--
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/15a84f44-8d19-48e8-aacf-941598d41fa9n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Resource url

Alessandro  Vernet
Administrator
Hi Manish,

Yes, you can use "Value Templates" (see link below), i.e. XPath between
curly braces, in that path. So something along these lines should work. And
you can have several of those in the same attribute, if needed.

    resource="https://www.google.{ if(…) then 'com' else 'co.in' }"

https://doc.orbeon.com/xforms/core/attribute-value-templates

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

Re: Resource url

mbojja
Below are the two url's that I require based on the if-else condition. If ' $fr-search-value is more than one word' then 'URL 1'  else ' URL 2' 

 URL 1. https://{xxf:property('username')}:{xxf:property('passwd')}@{xxf:property('url')}/employees?type=STAFF&resultPageSize=100&names={$fr-search-value}
 URL 2. https://{xxf:property('username')}:{xxf:property('passwd')}@{xxf:property('url')}/employees?type=STAFF&resultPageSize=100&first-name={$fr-search-value}&last-name={$fr-search-value}
  
For this to work I'm using the below resource Url which does not seem to work. Can you please let me know what am I doing wrong here?

Resource =
https://{xxf:property('username')}:{xxf:property('passwd')}@{xxf:property('url')}/employees?type=STAFF&resultPageSize=100&{if(count(for $x in tokenize($fr-search-value,'\s')) !=1) then 'first-name={(for $x in tokenize($fr-search-value,'\s') return concat('%25',$x,'%25'))}&last-name={(for $x in tokenize($fr-search-value,'\s') return concat('%25',$x,'%25'))}' else 'names={$fr-search-value}'}

Thanks

On Thu, Oct 22, 2020 at 6:46 AM Alessandro Vernet <[hidden email]> wrote:
Hi Manish,

Yes, you can use "Value Templates" (see link below), i.e. XPath between
curly braces, in that path. So something along these lines should work. And
you can have several of those in the same attribute, if needed.

    resource="https://www.google.{ if(…) then 'com' else 'co.in' }"

https://doc.orbeon.com/xforms/core/attribute-value-templates

‑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/1603320388890-0.post%40n4.nabble.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/CAN39TsNF6FrQ0WdiiHmwuRJ608zccaikF9bppM5JLYiEPs31Og%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Resource url

Alessandro  Vernet
Administrator
Hi Manish,

Not really: how is it not working? Are you getting an error in the
`orbeon.log`? Is the service called, but with the wrong parameters? Or not
at all? I would try to simplify the URL, starting with something entirely
static, and adding to it little by little so you can see at every step what
could be causing the problem.

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