Add new field to a table

3 posts / 0 new
Last post
Bobby
Offline
Joined: 12/10/2015 - 04:44
Add new field to a table

Hello all,
I have a makro running in IDEA 8.5. However, at some point the makro has a runtime error when I use it in IDEA 9.2. The error occurs when the makro adds a new field to a table. The code is as follows
'Add new field to existing table StrKumSumFeldName = "Kum_Sum"    ' Add new field Set ObKumSumFeld = ObKumSumTable.NewField     ObKumSumFeld.Name = StrKumSumFeldName ObKumSumFeld.Description = ("this is the new field") ObKumSumFeld.Type = WI_NUM_FIELD ObKumSumFeld.Length = 15 ObKumSumFeld.Decimals = 2 OBKumSumTable.AppendField ObKumSumFeld
The debuggers stops at the last line. I do not have the exact error message in English since I am using a German version of the programm. However it somehow: "No cell information available". Does someone have an idea what is wrong?
 
Thank you so much for you support
Bobby

Bobby
Offline
Joined: 12/10/2015 - 04:44

'Add new field to a table
 StrKumSumFeldName = "Kum_Sum"    ' Add new field
 Set ObKumSumFeld = ObKumSumTable.NewField   
 ObKumSumFeld.Name = StrKumSumFeldName
 ObKumSumFeld.Description = ("this is the new field")
 ObKumSumFeld.Type = WI_NUM_FIELD
 ObKumSumFeld.Length = 15
 ObKumSumFeld.Decimals = 2
 OBKumSumTable.AppendField ObKumSumFeld
(Now the code looks better)

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Bobby,

When you create a field you need a default value.  That is what you are missing in your script.  So you need a line such as:

ObKumSumFeld.Equation = 0

This will set your new field to 0.  You could also use equations that are created through the equation editor.

Hope this helps.

Brian