Casting a N/A value into an orbeon Date field and an Orbeon number field

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

Casting a N/A value into an orbeon Date field and an Orbeon number field

Dylan Strachan
Hello All,

I am trying to cast N/A to date and number fields if they are null and if a question is selected as no. What I have right now is:

if($Control1 = 'No') then ($Control2 [string() castable as xs:string] = 'N/A') else .

With Control2 being a date field, and Control1 being a Yes/No radio button field. I also need this logic for Control2 if it were a number field. 

Normally we would set up logic to send N/A through the hide stream and we have done that before. In this case however we need the N/A to be able to be seen within the form as the agency using this form needs to be able to see N/A in the field upon printing.

Any help would be greatly appreciated!

Best,
Dylan

--
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/0389fd0b-5b44-4df0-9c4b-c9996d6c742bn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Casting a N/A value into an orbeon Date field and an Orbeon number field

Alessandro  Vernet
Administrator
Hi Dylan,

Would you be able to create a simple form where you have those fields setup,
maybe with Form Builder on https://demo.orbeon.com, so we can see and run
what you have? Then you can share with us here the link to the form, and
also attach the source to your message (data on https://demo.orbeon.com
being publicly accessible, it can disappear at any time).

(I am a bit puzzled by Control2 being a date field, but sometime having a
value of "N/A". Obviously, that isn't a valid date, and would be unexpected
for a date field.)

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

Re: Casting a N/A value into an orbeon Date field and an Orbeon number field

Dylan Strachan
Hello Allesandro,

I have created a Test form called Demo_NA_Functionality.

I need N/A to default to all fields if they are not answered. In some cases they will not be visible because of the logic put into the sections with dependencies on the answer to the Third party payer question.  Basically if upon form submission these fields are null I need them to display N/A.  this goes for every field after the Sample Insurance? field.

Thank you for your help and let me know if you need anything else.

Best,
Dylan

On Fri, Dec 11, 2020 at 1:16 AM Alessandro Vernet <[hidden email]> wrote:
Hi Dylan,

Would you be able to create a simple form where you have those fields setup,
maybe with Form Builder on https://demo.orbeon.com, so we can see and run
what you have? Then you can share with us here the link to the form, and
also attach the source to your message (data on https://demo.orbeon.com
being publicly accessible, it can disappear at any time).

(I am a bit puzzled by Control2 being a date field, but sometime having a
value of "N/A". Obviously, that isn't a valid date, and would be unexpected
for a date field.)

-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 a topic in the Google Groups "Orbeon Forms" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orbeon/qPVq1WxTg-g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1607670991932-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/CAE2Vpu%3D-3%2B5oFMWpoAb7_aHRUCs%3DwBxfS3tOABzPf%2BSsqJtv1g%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Casting a N/A value into an orbeon Date field and an Orbeon number field

Alessandro  Vernet
Administrator
Hi Dylan,

Got it, so you need the value of any field left empty to become "N/A" in the
data you submit. By "submit", are you referring to the `send()` in a
process? If so, you could maybe add to your process after you save the data,
but before the `send()`, something like:

    xf:setvalue(
        ref = "//*[empty(*) and xxf:is-blank(.)]",
        value = "'N/A'",
        all = "true"
    )

For more on the `xf:setvalue()` action, see the link below. Would something
like this works for you?

https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/actions-xforms#xf-setvalue

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

Re: Casting a N/A value into an orbeon Date field and an Orbeon number field

Alessandro  Vernet
Administrator
Hi Dylan, did you get a chance to look into using `xf:setvalue()` in your
process, to have value of any field left empty to become "N/A"? If so,
you'll let me know if it worked.

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