05-16-2007 01:25 AM
Hi,
I have a problem concerning .NET that I hope you could give me a solution to.
The problem is a Web services where I trying to write to a variable that is of type "Nullable". It is of a ".NET Refnum"-type that in my case contains a boolean and a time stamp (dateTime). It works fine to read it but I can not write to it, i.e. I do not have the option to choose "Change All to write" on the property node.
In the example below "CalenderValue", "IntegerValue" and "StringValue" all have nillable="true" but it is only "CalenderValue" and "IntegerValue" that behaves as described above.
Since there is no public constructors for the "Nullable"-type (mscorlib/system/nullable ???) I am not able to create a valid refnum.
Do you know what I should do to be able to assign values to these variables? (It works fine to write to doubles, integers and strings.)
Class and method from WSDL file:
<xs:complexType name="TestVO">
<xs:sequence>
<xs:element minOccurs="1" name="DoubleValue" nillable="false" type="xs:double"/>
<xs:element minOccurs="1" name="IntValue" nillable="false" type="xs:int"/>
<xs:element minOccurs="1" name="IntegerValue" nillable="true" type="xs:int"/>
<xs:element minOccurs="1" name="StringValue" nillable="true" type="xs:string"/>
<xs:element minOccurs="1" name="CalendarValue" nillable="true" type="xs:dateTime"/>
</xs:sequence>
</xs:complexType>
<xs:element name="testSendData">
<xs:complexType>
<xs:sequence>
<xs:element name="vo" type="java:TestVO" xmlns:java="java:com.az.gsa.basil.webservice.exposuresampling"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="testSendDataResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Best Regards
Robert Lindberg
05-21-2007 11:38 PM
02-16-2012 02:39 AM
You can achieve this by using the system.nullable class.
First you decide whether the refnum needs to be null, if so use a constant of that class (nullable.timestamp for instance), if not use the labview function 'to .net object', and use 'to more specific class' to create a nullable object with a value.
Here's an example for a timestamp:
Ton
03-09-2012 06:05 AM
I've written a blog post on this subject: TonOnLabVIEW
Ton