DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Viewing Assignment Values in View

I have a numeric channel, and each value represents a specific state, so I'm using an assignment channel.  The assignments are in the channel properly, but how do I show those assignment values in the view tab?  What I was thinking was to use the legend and wherever the cursor was, the legend would display the assignment value corresponding to the Y value the cursor is at.  I see a legend property for "Assignments" but it doesn't seem to do anything.

 

Please let me know if you have any ideas how I can do this? 

 

Thanks. 

0 Kudos
Message 1 of 7
(3,951 Views)

After a little more digging, I figured out it is only displaying the default assignment value, not the text that is actually assigned to the value.  Any way to fix that?  

0 Kudos
Message 2 of 7
(3,941 Views)

Hi Russell,

 

I think you have two options.  You can create a parallel string channel to your assignment channel that has all the correct row-by-row values, then you can show that row's string value in the legend or wherever you want.

 

Set ChnResult = ChnConvertAssignmentToText(AssignmentChannel, True)

 

The second option, if you have script code running that can resolve the correct assignment value, is to request that value programmatically.  You can get the numerical value from the assignment channel with the DValues() property, but you automatically get the resolved text value if you request the usual Values() property:

 

DataFilePath = "C:\Users\Public\Documents\National Instruments\DIAdem 2020\Data\Report_Data.tdm"
Call Data.Root.Clear()
Call DataFileLoad(DataFilePath, "TDM")
Set Group = Data.Root.ChannelGroups("Temperature data")
Set AssignmentChannel = Group.Channels("Temperature as assignment")
Row = 4
NumericalValue  = AssignmentChannel.DValues(Row)
AssignmentValue = AssignmentChannel.Values(Row)
MsgBox "Row = " & Row & vbCRLF & NumericalValue & vbCRLF & AssignmentValue

 

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 3 of 7
(3,900 Views)

Thanks Brad:

 

Not 100% ideal, will future versions of Diadem display the assignment value in the legend depending on the position of the cursor?  Seems like the legend property for assignments is fairly useless right now since it just displays the default value. 

Also, a couple more question, if don't mind. 

  • Is there a better resource that defines what user actions trigger certain events?  Right now, I'm concerned most with everything that can trigger the OnActiveSheetChanged and OnCursorChanged events.  
  • What is an internal channel?  This page recommends not accessing internal data during a user command triggered by an event.  I'm not sure what is meant by internal channel.  I thought it was data loaded in the data portal, but the ChnIsIntern command returns false when I check a channel in the portal.   https://zone.ni.com/reference/en-XX/help/370858P-01/genshell/genshell/genshell_generalevents/

 

As always, thank you for being so pro-active on this site.  

0 Kudos
Message 4 of 7
(3,872 Views)

Hi Russell,

 

I think that's a good suggestion (to have a configuration choice to show the assignment value in the VIEW legend based on cursor movement).  That should actually be a very simple feature to add.  Would you mind submitting that to the DIAdemIdeas page?

 

https://forums.ni.com/t5/DIAdem-Idea-Exchange/idb-p/diademideas

 

For the time being, you can kludge this together with a <free text> expression in the legend.  I'm attaching a TDV file that shows how this works for the data set that this script loads:

 

DataFilePath = "C:\Users\Public\Documents\National Instruments\DIAdem 2020\Data\Report_Data.tdm"
Call Data.Root.Clear()
Call DataFileLoad(DataFilePath, "TDM")
MsgBox Data.GetChannel("[6]/[4]").Values(View.ActiveSheet.Cursor.P1)

 

I don't know of a resource that lists all the user actions that can trigger X event in DIAdem.  The OnActiveSheetChanged event just triggers whenever the DIAdem panel is switched, manually or programmatically.  I don't know of any other action that triggers that event.  The OnCursorChanged event just triggers whenever the cursor in DIAdem VIEW is moved, manually or programmatically.  I don't know of any other action that triggers that event.

 

I believe by "internal channel", the Help is referring to channels that exist in memory but do not appear in the Data Portal.  DIAdem uses "invisible" data channels for a variety of purposes, for instance Curve Transformations in REPORT and also for XY graphing of Y channels vs. waveform properties or array index (in those cases implicit invisible channels).  The short version here is that if you're not trying to edit an "internal channel", you won't do so by accident, so you can probably forget about that tip.

 

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 5 of 7
(3,843 Views)

Suggestion posted. 

 

Could I use a free text expression in the legend to show the assignment value? 

0 Kudos
Message 6 of 7
(3,812 Views)

Hi Russell,

 

Yes, and the TDV file I attached to the previous post shows what's available.  I don't know of a way to automatically reference the CurrentChannelName (CCN) within the VIEW legend expression, the way you can for REPORT legend expressions, so that means you have to insert the channel reference explicitly in the legend expression... but otherwise it works.  Just a little clunky.

 

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 7 of 7
(3,718 Views)