<xsd:element name="OptionalDate" nillable="true" type="xsd:xsd:dateTime" />
If the fist record comes from the DB as NOT null and we want to use the node
we remove nil attribute:
If de.getAttribute("xsi:nil") Then de.removeAttribute("xsi:nil") End if
and populate the node. No problemo.
However, from then on the field becomes required. ( * Only date and time
allowed). This is a problem since this is an optional field I do not want to
use it in every record.
So....
If I set nillable = true in the XSD the field becomes required (after the
attribute removed)
OR
If I leave out attribute it is always required.
Is this right? Please tell me what I have overlooked.
Thanks,
Frank
This is true for date, boolean, numeric and other non-string data types.
--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com
"FrankS" <Fra...@discussions.microsoft.com> wrote in message news:561E7084-9D70-4F6D...@microsoft.com...
If blnNillable Then
de.setAttribute("xsi:nil", True)
Else
de.removeAttribute("xsi:nil")
End If
it removes it just fine but gets an error on the set: The attribute 'nil' on
the element xxx is not defined in the DTD/schema. The set attribute is not
working.
Please give example? Thanks
Frank
Thanks,
Try
If blnNillable Then
Dim xa As IXMLDOMNode
xa = de.ownerDocument.createNode(2, "xsi:nil",
"http://www.w3.org/2001/XMLSchema-instance")
xa.text = "true" 'must be lowercase
de.setAttributeNode(xa)
Else
de.removeAttribute("xsi:nil")
End If
Catch ex As Exception
thisXDoc.UI.Alert(ex.Message)
End Try
Yes the values are case-sensitive. But this isn't always a commonly known issue.
--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com
"FrankS" <Fra...@discussions.microsoft.com> wrote in message news:2C5BBB80-0238-4A44...@microsoft.com...