キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Build Array of Contents in Variant

解決済み
解決策を見る

Is there an easy way to take a variant that might contain anything and output a variant that contains an array of that thing?

Clipboard.png

Build array won't work because it will yield {Array{Variant{Thing}}} and what I need is {Variant{Array{Thing}}}.

"If you weren't supposed to push it, it wouldn't be a button."
0 件の賞賛
メッセージ1/8
4,276件の閲覧回数

What kinds of "things" are you talking about?

 

The key point of arrays is that every element must be of the same type.  So if you want an Array{Thing}, then every Thing in that array must be the same type of Thing.

 

 

0 件の賞賛
メッセージ2/8
4,274件の閲覧回数

What about using variant attributes? They allow you to create arbitrary lists of anything.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 件の賞賛
メッセージ3/8
4,272件の閲覧回数

Not "things", "thing".  The "thing" could be anything.  I have an incoming variant that might contain anything (I don't have any control over it).  I want to build an array of that "thing" and put it into a variant.

"If you weren't supposed to push it, it wouldn't be a button."
0 件の賞賛
メッセージ4/8
4,264件の閲覧回数

Since the thing is a variant, and you want to put an array of those "things" into a variant, it sounds like you want a Variant{Array{Variant}}.

 

Capture.PNG

0 件の賞賛
メッセージ5/8
4,252件の閲覧回数

@RavensFan wrote:

Since the thing is a variant, and you want to put an array of those "things" into a variant, it sounds like you want a Variant{Array{Variant}}.

 

Capture.PNG


Not quite.  The "thing" is not a variant, it is what is inside a variant.

Your code produces a variant of an array of variants of things.

I want a variant of an array of things.

"If you weren't supposed to push it, it wouldn't be a button."
0 件の賞賛
メッセージ6/8
4,211件の閲覧回数
解決策
トピック作成者paul_cardinaleが受理

As happens not infrequently, the solution came to me as I was laying in bed waiting to fall asleep.

bv.png

"If you weren't supposed to push it, it wouldn't be a button."
メッセージ7/8
4,208件の閲覧回数

That usually works, but it gags if the "thing" is an array (because it tries to put an array in an array).

It should act like "Build Array", and if it gets an array as an input, just add another dimension.

Here's the fixed version:

bv.png

Note: This doesn't pass any data along, it always outputs an empty array (for my I app, I only need the variant to contain type info).

"If you weren't supposed to push it, it wouldn't be a button."
0 件の賞賛
メッセージ8/8
4,138件の閲覧回数