hi everybody ,
i am facing a trouble of changing the datatype of variant and string
Is there any method or example to convert the 2D variant to 2D string ?
i have already tried to use "variant to data " many times but fail.
is there any other method or example ?
Thank You !!!
Solved! Go to Solution.
What is a 2D variant??? A 2D array of variants? A 2D array of strings converted to a variant??
Can you attach a small Vi containing your variant so we can see what you actually have? Where does the variant come from?
What did you wire to the type input of varant to data? A 2D array of strings? What kind of error do you get when it "fails"?
i am using Database toolset and i select the data from database with 2D variant datatype
after that , i have some 2D string data type data , and i want to insert one of the row of this 2D string data into the 2D variant
and update it to the database.
but the result of my porgram can show the combination of the two information.
i have attached a small program for your reference
You don't have a Varaint of a 2D array of strings, but a 2D array of variants. Since your VI does not contain any default data, we can only guess what's actually inside the variant. If each variant is a simple string, you could use 2 FOR loops as follows. Try if this works.
If this does not work, please make sure the VI you attach contains data (make current values default before saving). We currently really don't have enough information to solve the problem.
...or this. BTW, I've given up on using the Database Variant To Data function because it won't accept an array at the 'type' terminal.
Jim's code works (at least in 8.2):
But I guess you don't have a variant with string contents.
You could use the 'Variant probe' to see what kind of data is inside the variant. Place the probe on a 1D or scalar element of your 2D array see what datatypes are returned.
Those information are very useful and help me a lots
Thank you very much !!
Now i can use it to convect ...