LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
r_exler

update value within array of cluster

Status: New

Updating a value within an array of cluster is too complicated compared to other programming languages.

 

In my application I hold an (global) array of jobs to do, each consisting of its name and an array of (different) parts belonging to this job. One element of the part's description is the number of parts already done. If I want to update this value, the code looks:

 

BlockDiagram.jpg

Note the calling function has to update the global variable after updating or JobFilesIn and JobFilesOut can be replaced by reading/writing the global which does not make the code more visible.

 

Within C code the update would look

JobFiles[JobFileIndex].Parts[PartIndex].Done=Done;

which will not raise the need of making it a function (VI) at all.

 

A solution might be similar to Replace Array Subset if the compiler is parsing the data type on the input and accepting indices and cluster element names as shown below

Replace.jpg

Of course this should work with any data type selected from the initial variable by the selectors similar to C code

variable[index].element=array;

 

 

It also should accept a cluster as top level element as well, e.g. to replace an element within an cluster of clusters similar to C code

variable.element.subelement=WhateverDataTypeThisIs;

 

or an element within an array which is part of a cluster.

variable.element[i]=WhateverDataTypeThisIs

 

All the C code examples above expand to LabVIEW code which is hard to read.

 

21 Comments
GregSands
Active Participant

X, yes, I had misunderstood, and your actual suggestion is sensible. Also it would be simple to have a popup tree here as well as an auto-complete.

 

I had kudoed both those other ideas as well, which do look similar. I think the meta-idea that encompasses all of them is being able to create compact vertical code to save on "wasted" horizontal space, however LabVIEW really isn't designed to do that. Another example is the link I mentioned before which has a vertical IPES:

 

Nested In Place Structure Chain