Jump to content

Convert Variant 2D array to string and return back


Recommended Posts

I must transfer to tcp-ip protocol the extraction of ado-tools, but i have some problem in the conversion in string

If I convert the array with "varinat with flattened string" or "flatten to string" i have the error or corrupted the data

If I convert every variant in string, after flatten the array and rebulit the variant array, i can't retur to original data

you can advise how to transfer these data via the protocol tcp-ip?

Link to comment

Can you post an example of your code?

Variants you get from a database are mostly the same as standard LV variants. There are some corner cases (null values is one I'm aware of) where you would want to use the DB variant to data primitive, which comes with NI's DB toolkit, but I believe should also ship in standard LabVIEW.

Link to comment

QUOTE (Yen @ Apr 30 2008, 01:04 PM)

Can you post an example of your code?

Variants you get from a database are mostly the same as standard LV variants. There are some corner cases (null values is one I'm aware of) where you would want to use the DB variant to data primitive, which comes with NI's DB toolkit, but I believe should also ship in standard LabVIEW.

Well it's a built in node so it is in every LabVIEW version but it is not shipping with standard LabVIEW in the sense that there is nowhere a menu palette where you could select it from. And NULL is the most noteworthy speciality of that conversion routine, since LabVIEW itself does not know a canonical NULL datatype (at least on diagram level).

Rolf Kalbermatter

Link to comment

QUOTE (Harvey @ May 1 2008, 11:31 AM)

probably not much I explained well

I have to convert in string the data to transmit to the client and then reconvert

because being a generic function not know the type of data

OK. Intead of using the TD of the void variant(after TCPIP reception), take the TD of a 2D array of variants. You could also use "Unflatten from String" with a 2D array of variants as type to make the converion in a single step.

For the conversion to cluster inside the loop, take my previous example for the cluster.

Link to comment

QUOTE (Harvey @ May 1 2008, 12:29 PM)

the problem is that the example that I made does not work, although it should be

when flatten the string or give me error or corrupts the data

No. The example that you gave can't work unlless you make the modification I suggested. You have flattened a 2D array of variants so you have to unflatten a 2D array of variants after reception.

Link to comment

There is a specific problem with OLE variants not keeping their values. You can see an example here. Looks like the only solution is to convert the data before sending it. For example, you can convert it to a 2D array of strings.

QUOTE (rolfk @ May 1 2008, 09:04 AM)

Well it's a built in node so it is in every LabVIEW version but it is not shipping with standard LabVIEW in the sense that there is nowhere a menu palette where you could select it from.

At least in 8.5.1 it's in Add-ons>>DB Tools even if you don't have the toolkit installed.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.