From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace by index channels with by name in pre-existing report

Solved!
Go to solution

We have a large report what we would like to change from the [Group Index] Structure to the [Group Name] Structure so we can add and delete channel and find them by name rather than index. 

 

I expected that changing the syntax dropdown from:

[Group index]/Channel name

 

to 

 

Variable: ExtendChnName

Group name/Channel name

 

 

Would allow me to automatically find the new groups after I change the order of Channel groups on a pre-generated report. However, thus far I have been unable to get the report to update. 

 

The settings are explained here: http://zone.ni.com/reference/en-XX/help/370858M-01/varoff/extendchnname/

 

I changed the setting from the general settings page: http://zone.ni.com/reference/en-XX/help/370859J-01/dlgshell/dlgshell/dlgconfshell_dialog/

 

If Brad or another guru doesn't know this off the top of their head I can provide an example project. 

 

Thanks for the help guys. 

 

0 Kudos
Message 1 of 3
(2,304 Views)
Solution
Accepted by topic author TheWyrd

Hi TheWyrd,

 

The setting of ExtendChnName is only used for interactive behavior, for example drag & drop. It depends on the type of problem which setting is the best. If once a layout is created the channel reference is fix and there is no build-in function to change this.

So, if you will change the current setting in the layout, you must do this with a script. For this you load the layout and a corresponding dataset. Then read the current channel reference for X and Y channel, find these channels in the Dataportal and write back the new reference.Here is an example for the loaded dataset and layout. To finalize it you must add a loop over all REPORT sheets and objects.

 

Dim o2DCurves, oShapeType, iLoop

Set o2DCurves = Report.ActiveSheet.Objects.Item("2D-Axis1").Curves2D for iLoop = 1 to o2DCurves.Count select case o2DCurves(iLoop).ShapeType case e2DShapeLine call ChangeReference(o2DCurves(iLoop)) case e2DShapeLineAndPoints call ChangeReference(o2DCurves(iLoop)) ' case .... end select next '------------------------------------------------------------------------------- sub ChangeReference(o2DCurves) dim oChnList ' in case of waveform channel -> no entry if o2DCurves.Shape.XChannel.Reference <> "" then set oChnList = data.GetChannels(o2DCurves.Shape.XChannel.Reference) if oChnList.Count > 0 then o2DCurves.Shape.XChannel.Reference = oChnList.Item(1).GetReference(eRefTypeNameName) end if end if if o2DCurves.Shape.YChannel.Reference <> "" then set oChnList = data.GetChannels(o2DCurves.Shape.YChannel.Reference) if oChnList.Count > 0 then o2DCurves.Shape.YChannel.Reference = oChnList.Item(1).GetReference(eRefTypeNameName) end if end if end sub

Greetings

Walter

 

0 Kudos
Message 2 of 3
(2,280 Views)

Hi Walter, 

 

Thanks for the reply, I appear to have posted the same question twice somehow. Brad also had some input here: 

 

 

https://forums.ni.com/t5/DIAdem/Replace-by-index-channels-with-by-name-in-pre-existing-report/m-p/37...

 

Your explanation makes sense and extends on what he explained.

 

 

 

 

 

 

 

0 Kudos
Message 3 of 3
(2,270 Views)