W3C home > Mailing lists > Public > www-forms@w3.org > July 2006

Can you nest if statements within Xforms constraints?

From: Flinton Adam <Adam.Flinton@cfh.nhs.uk>
Date: Mon, 31 Jul 2006 13:08:52 +0100
Message-ID: <595299DD7F30014BBCE48B93DCB60652045A26EA@EXCHAQ2.nhsia.nhs.uk>
To: <www-forms@w3.org>

Dear All,

We have a field which is a "complete OID" (OID = Object ID) which is a
concatentation of an OID prefix & an OID suffix. The complete OID must
be Unique & must be of the OID pattern.

The OID pattern is set via a schema & that's OK but I have to also be
able to check the uniqueness. As such I have a second instance which is
a list of all the OIDs.

I then evaluate it via "if
(count(instance('All_comp_OID')//comp_OID[text() =
instance('main')/comp_OID/text()]) = 0,true(),false()),true())"

However if an OID has already been added then if I wish to edit it (only
a few fields & then not the OID) I need to only apply the constraint if
the OID_key indicator is not 0.

As such I first need to evaluate "if(../OID_key != 0" & then if true go
& see if the value is unique .e. 2 if statements need to be nested.

At the moment I haveL

<xforms:bind nodeset="comp_OID" id="comp_OID_id" type="oid"
readonly="true()" calculate="if(../OID_key != 0,
concat(../ISO_Root/text(),'.', ../OID_suffix/text()), text())" 
	constraint="if(../OID_key != 0,if
(count(instance('All_comp_OID')//comp_OID[text() =
instance('main')/comp_OID/text()]) = 0,true(),false()),true())" />


But the constraint seems to have no effect, i.e. when I create an OID I
know to be not unique then....if appears to be valid.

So many question is....can an if statement in a constraint be nested
within another if statement?

Adam

This e-mail is confidential and privileged. If you are not the intended recipient please accept our apologies; please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents: to do so is strictly prohibited and may be unlawful. Please inform us that this message has gone astray before deleting it. Thank you for your co-operation.
Received on Monday, 31 July 2006 12:09:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:05 GMT