LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET Web services. Variable of type "Nullable"

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

0 Kudos
Message 1 of 4
(4,376 Views)
Hiya Jamc,

I'm a novice at this, but here's some info I found.

It looks like there are two "nullable" constructs in the .NET system: the System.Nullable class, and the System.Nullable Generic Structure.  The class exists to provide comparison support for the structure.  The class is static, so it can't be instantiated.  The Nullable Generic Structure holds the actual value, which is placed there by its own constructor.

Unfortunately, according to http://forums.ni.com/ni/board/message?board.id=170&message.id=169193, generics (like the structure) don't have support in LV, and so are filtered out of the creatable objects list.  Net result (pardon the pun): no nullables in LV.

Sadly, I don't have a good solution for the problem.  You may have to end up hacking together an implementation with standard value types, and try to work around the nullable property by filtering.  It's difficult to tell without knowing more about your system.

Good luck,

Joe Z.
0 Kudos
Message 2 of 4
(4,346 Views)

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:

NulllTimestamp.png

 

Ton 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 3 of 4
(3,842 Views)

I've written a blog post on this subject: TonOnLabVIEW

 

Ton 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 4
(3,826 Views)