DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to copy header items and paste it into a new channel

Hi everybody,
 
i'm trying to customize my tasks with DIAdem and got some big problem. I have a channel table in VIEW with 295 columns and have added a new column.In this column i want to write all the Header Items i've got.
I've created a new channel with:
 
Call ChnAlloc("Betriebsdaten_akt_Monat", 295, 1,DataTypeString,"Text")
Call Zusfassg.Columns.Add(296)
Then I use this command to read the header items:
Set MyHeaders = View.ActiveSheet.ActiveArea.DisplayObj.HeaderItems
 
But how could i now paste all these items into the new column i've created?
 
Thanks in advance for your help.
 
Kind regards
 
Patrick
Patrick Etoumann
0 Kudos
Message 1 of 4
(3,646 Views)
Hello Patrick,
to be honest, I did not completely understand what you are trying to do - so if the answer does not fit 100%, please give me some more information about your task.

Within the DIAdem Help (topic: Object HeaderItem) you can find this short script:
Set oMyHeaders = View.ActiveSheet.ActiveArea.DisplayObj.HeaderItems
  For Each oMyHeaderItem in oMyHeaders
  Call MsgBoxDisp(oMyHeaderItem.Name)
Next

It calls a messagebox for each configured headeritem. If you want to write the titles of these items into a new channel you can use the ChT() variable. Specify the row and a textchannel as parameters of this function.
But because you created a textchannels with a length that equals the numlber of displayed channels i think you rather want to copy the content of a specific header property to the rows of that column. In this case it might be most convenient to program a for loop and use the loop variable to reference the individual channels. With the command ChnPropGet(), the channel number and the property name you can read the value of a property.  Even here, use ChT() to store the data into the new channel.


Ingo Schumacher
Systems Engineering Manager CEERNational Instruments Germany
Message 2 of 4
(3,611 Views)
Hi Ingo,
 
Thanks for your answer.After i sent my question i found a way to do it the same you proposed.But it was unfortunetly not what i wanted.
In this case  i obtained only the names of all the items of my data like name, number,length,etc., but it is not my objective.
 
My task is to copy the name( or title) of all my columns and to write them in a new created one.For example, if i have three columns like date/time, temperatur,pressure; i need to build a new text column 'Resumee' with these three names as the rows of 'Resumee'.
 
I'll try it with CHT() as you said, and i hope it's the better way.
 
In the same way, can you please tell me how i can add a new row in my channel table with DIAdem 9.1.In the Help Book ,there's this command "Object.Row.Add" but it didn't match, i always get an error message.
 
 
 
 
 
Patrick Etoumann
0 Kudos
Message 3 of 4
(3,592 Views)
Hi Patrick,

you can use this short script to create the resumee channel (=coulumn) . But please mind, its just a quick example I created. It is not expected to work correctly if there allready is a channel called resumee. I just wanted to shoe you the principle and keep it simple.
noChn = globUsedChn
Call chnalloc("Resumee",noChn,1,DataTypeString)
for i = 1 to noChn
cht(i, cno("Resumee"))= ChnPropGet(i, "name") 
next

To add the channel to a table in VIEW, you can use the command
view.activesheet.ActiveArea.DisplayObj.Columns.Add("Resumee")
regards
Ingo Schumacher
Systems Engineering Manager CEERNational Instruments Germany
Message 4 of 4
(3,586 Views)