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.
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.
05-16-2005 08:50 AM
05-17-2005 01:22 AM
07-10-2013 05:04 AM - edited 07-10-2013 05:12 AM
Hello,
this is quite an interesting thread for a beginner like me, though it is eight years old now.
I would like to display some properties of a given channel (but not all of them) in a 2D table, like
Number
Name
Property4
Property7
Property8
Would you know how to do this with DIAdem 2011 (via script of course) ? There are very few code examples on the Internet showing how to display some table the way you wish.
Thanks in advance.
07-10-2013 10:12 AM
Ok I have found something that works (in another thread of this forum) :
Call GlobalDim("Tblcol1(4), Tblcol2(4)") Tblcol1(1) = "Root Name" Tblcol1(2) = "Group Name" Tblcol1(3) = "Channel Name" Tblcol1(4) = "Channel Number" Tblcol2(1) = RootPropValGet("Name")
but then, I could not put titles for columns. So I found another way... but it does not compile. I really wish this code worked because then it is quite easy to add titles. This is the code I am talking about :
Call GraphObjNew("2D-Table", "Table1") Call GraphObjOpen("Table1") Set oColumns = Table1.Columns Table1.Columns.Item(1).Cells(2).Value = "Root Name" Table1.Columns.Item(1).Cells(3).Value = "Group Name" Table1.Columns.Item(1).Cells(4).Value = "Channel Name" Table1.Columns.Item(1).Cells(5).Value = "Channel Number" Table1.Columns.Item(2).Cells(2).Value = RootPropValGet("Name") Call GraphObjClose("Table1")
found here. Could you please help me out ?
07-10-2013 05:23 PM
Hi Near,
Your latest post suggests you are in fact using DIAdem 2012, the first DIAdem version which supports the Report object. Please specify clearly whether a solution that works only in DIAdem 2012 is acceptable-- this will be much easier to provide.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
07-11-2013 01:29 AM
Hi Brad,
I do not have DIAdem 2012 for sure. But since the link I provided has "DIAdem 2011 Help" written in the title, it then occured to me that those lines should work. Apparently I was wrong.
07-11-2013 02:34 AM
Hi Nera3
The help topic you find belongs to the SUD Dialog box editor of DIAdem (the disadvantage of the help in the web is that is hard to find the context). In DIAdem 2012 it would be easy as in this example but you use DIAdem 2011 so you have to use the old way :-<
The easiest way is to do it manually in REPORT and the press CTRL-A (In DIAdem 2012 CTRL-Shift-C). Then DIAdem will copy some code in the clipboard that you can paste into SCRIPT. You can also copy the properties from the DataPortal to SCRIPT to find the code to access the properties. Finally you will get some code similar to this (I removed a lot of recorded code):
Call GraphObjOpen("2D-Table") '------------------- Table -------------------------- D2TabDataType(1) = "Channel" D2TabVariable(1) = "" D2TabChnName(1) = "[1]/Geschwindigkeit" '------------------- Headline -------------------------- D2TabTxtVector(1)= "Name: @@Data.GetChannel(#).Properties(""name"").Value@@" D2TabTxtVector(2)= "Name: @@Data.GetChannel(#).Properties(""number"").Value@@" D2TabTxtVector(3)= "Name: @@Data.GetChannel(#).Properties(""MyProperty"").Value@@" Call GraphObjClose("2D-Table")
To create the table use the code:
Call GraphObjNew("2D-Table","2D-Table")
Finally you have to update the REPORT
'Refresh REPORT Call PicUpdate
Hope this helps
Winfried
07-11-2013 03:08 AM - edited 07-11-2013 03:16 AM
Hi Winfried,
Ok so it worked ! My only problem now is that everything is quite narrow. See below. Would you know a way to fix this ?
Also if possible, I would be interested in putting different Titles to each column !
07-11-2013 03:29 AM
Hi Near3
Have you tried the CTRL-A trick? It will create code for all possible settings and you can remove what you do not need.
To create individual you have to use D2TabTxtType
D2TabTxtType(1) = "column defined headline" D2TabHeaderTxt(1,1)= "Name: @@Data.GetChannel(#).Properties(""name"").Value@@" D2TabHeaderTxt(1,2)= "Name: @@Data.GetChannel(#).Properties(""number"").Value@@"
The hight could be set with D2TabTxtField. If you mark the word in SCRIPT and press F1 the help will show you the help for this variable.
Hope this helps
Winfried
07-11-2013 04:12 AM
I have tried it more than once but I have never pasted anything sadly... Or maybe I missed something ? For example, I manually added some text (as a title) on top of the second column, then pressed CTRL + A, then tried to paste somewhere, but nothing appeared.
Anyway, your code adds the second header just under the first one, still in the first column. At least it does on my computer. So I assumed that by (1,2) you actually meant (2,1) and tried it as well, but the title does not even show up that way. 😞
Thanks for your effort.