Dynamic Labels using if statement

48 views
Skip to first unread message

Seth Parkhurst

unread,
Aug 4, 2021, 11:53:19 AM8/4/21
to Orbeon Forms
I am sure this is posted somewhere but I am not able to find it.  But when using the new dynamic labels how do we implement an if/then/else statement.

something like this 
label

My Label needs value = {$value}

value Xpath expression if($control1 = 1) then $value0 else if($control2 =1) then $value1 else ''


Alessandro Vernet

unread,
Aug 16, 2021, 7:28:59 PM8/16/21
to Orbeon Forms
Hi Seth,

In Control Settings, Label, for the template parameter, instead of choosing Control Value, choose XPath Expression, and then use an expression like:

    if(//control-1 = '1') then 'a'
    else if(//control-2 = '1') then 'b'
    else ''

Note that in those XPath expressions, for now (see #‌309), you need to use `//control` instead of `$control`. You'll let me know if this works for you!

-Alex

--
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 orbeon+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/3ee1fce6-6de4-47c8-88cc-07bcb2e571fan%40googlegroups.com.

Seth Parkhurst

unread,
Aug 17, 2021, 12:46:46 PM8/17/21
to Orbeon Forms
It works thank you!  I figured it was documented but I had searched and did not find it.

Alessandro Vernet

unread,
Aug 17, 2021, 1:02:55 PM8/17/21
to Orbeon Forms
Excellent Seth; and yes, it is a bit tricky, especially the part about having to access control values with `//control` instead of `$control`, this until #‌309 is taken care of. And thank you for the confirmation.

-Alex

Reply all
Reply to author
Forward
0 new messages