DIAdem Idea Exchange

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

"add or replace" for data objects

Status: Declined

Hello

Thank you for your request. We understand your suggestion but given the age of this entry and the fact that just a few sponsors are supporting it, we have decided to decline this suggestion and prefer to develop more frequently requested features instead. We hope you understand this. 

Greetings

Walter

Hello

When developing scripts, I frequently add channel groups for analysis results, using

 

call data.root.channelgroups.add("analysis")

 

However, when re-running the scripts, successive groups "analysis1", "analysis2" etc. are created. This is a handy feature that I should not want to miss at some times, BUT

at other times I want to skip the creation of new channel groups. As a work-around I litter my code with 'exist'-statements such as

 

If not call data.root.channelgroups.exists("analysis") then

       call data.root.channelgroups.add("analysis")

end if

Set oResGrp = data.root.channelgroups("analysis")

 

Now, my suggestion is to add a command such as "AddOrReplace" or "Use", which would use the existing group if it exists and creates a new group if not. Pretty much the same behaviour as with the calculator, where

CH("NewChannel")= CH("oldChannel") will create a new channel or overwrite an existing one.

 

So

call data.root.channelgroups.add("analysis")

would work as we know it and

call data.root.channelgroups.Use("analysis")

would create a new object or use the existing one.

Alternatively one could supply an optional paramter to the .Add-method like

call data.root.channelgroups.add("analysis",0)

 as default using the well-known behaviour whereas

call data.root.channelgroups.add("analysis",1)

would change to create or replace.

 

Obviously the same would come in handy for channels or other objects that use an .add-method.

 

Thank you

 

Michael

2 Comments
Brad_Turpin
Trusted Enthusiast

Hi Michael,

 

I would find that handy also.

 

Thanks for the suggestion,

Brad Turpin

DIAdem Product Support

National Instruments

Walter_Rick
NI Employee (retired)
Status changed to: Declined

Hello

Thank you for your request. We understand your suggestion but given the age of this entry and the fact that just a few sponsors are supporting it, we have decided to decline this suggestion and prefer to develop more frequently requested features instead. We hope you understand this. 

Greetings

Walter