LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting: Insert Case Structure Frame

Solved!
Go to solution

Working in LV2020...

I have the following scripting code in order to insert a new frame into a case structure.

10Things_Rob_0-1749699207271.png

It works great... except LabVIEW doesn't realize it.

 

The target VI is broken with the following error: 

10Things_Rob_1-1749699353023.png

 

Thing is, it's there. Correct selector value and everything.

If I edit the case selector by adding a space and then deleting it, the VI fixes itself.

If I add one, then a second, then delete the second one, then the VI fixes itself

(so clearly nothing is actually WRONG with the first one I created)

 

Any Ideas what's going on?

 

NOTE: I did used to have Begin/Add Undo Transaction but the "dirty dot" never appeared, and I've been trying to simplify it down to the absolute minimum number of functions.

NOTE: The VI (or Block Diagram) being open and visible does not affect the behavior.

0 Kudos
Message 1 of 10
(907 Views)
Solution
Accepted by topic author 10Things_Rob

Hi,

 

It seems like a bug of CaseStructure property "FrameNames" that does not properly recompile the VI.

 

Try forcing recompilation with VI method "Compile":

raphschru_0-1749716300563.png

I managed to reproduce a similar behavior, but not exactly what you described.

Please attach code or at least provide more details on the selector data type (boolean, integer, enum ?) and the exact values written to "FrameNames".

 

Regards,

Raphaël.

 

Message 2 of 10
(868 Views)

Those frame names are tricky.

 

If the case uses strings, you might need to quote the string, like the case structure does when you type a string.

 

For enums, you shouldn't quote the strings, as the case structure doesn't do that when you type the enum names...

 

It's quite crude. It would be nice to have functions that return actual data in stead of literal strings.

 

Not sure if that's what's going on. So code would indeed help.

Message 3 of 10
(823 Views)

Here is what I find:

paul_a_cardinale_0-1749849504214.png

Note that there are always leading and trailing spaces.

0 Kudos
Message 4 of 10
(788 Views)

Wiebe (and future readers),

 

At your recommendation, I tried adding quotes and even adding spaces before/after quotes.

 

Neither worked (at least in 2020)

 

The VI Compile solution did seem to work though.

 

Thanks for your input.

-- Rob

Message 5 of 10
(715 Views)

Here's the testbench I was using to experiment.

The compile seems to do the trick.

I have not tried this on any version other than 2020.

__PRESENT

0 Kudos
Message 6 of 10
(713 Views)

@10Things_Rob wrote:

Here's the testbench I was using to experiment.

The compile seems to do the trick.

I have not tried this on any version other than 2020.

__PRESENT


I have tried with LV2024 Q3 64bit and the issue is still there.

 

Since you've most likely found a bug and a way to reproduce it, I would suggest to report it to NI.

You can simply give them a link to this forum thread so that you don't need to repeat all the steps to reproduce the bug.

 

Regards,

Raphaël.

Message 7 of 10
(671 Views)

Done. Thanks.

__PRESENT

Message 8 of 10
(661 Views)

The bug is still present in LV2025 Q3,

 

@10Things_Rob did you by any chance get a bug number when you reported it to NI? If yes, could you post it here?

0 Kudos
Message 9 of 10
(126 Views)

I had some very similar scripting code (nearly identical) and it used to work on LV2025Q1, maybe even 24Q3. Well, it stopped working around the time I installed 25Q3. I fixed my code by duplicating the new case and then deleting the duplicate. I think this is similar to recompiling the BD.Screenshot_2025-11-23_214954.png

0 Kudos
Message 10 of 10
(99 Views)