DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Group property can not be written with value type vbString

Hello,

 

I want to take some information out of a EXCEL-Sheet and write these into DIAdem Group properties. Therefore I use following program code:

 

groupprop_name = get_header.Sheets("Header").Cells(L,11).Value

head_line_entry = get_header.Sheets("Header").Cells(L,6).Value

Call Data.Root.ChannelGroups(1).Properties.Add(groupprop_name, head_line_entry)

Unfortunately I get error message with text:

 

German:

"Die Eigenschaft XXXXX kann mit einem Wert vom Typ vbString nicht erzeugt oder beschrieben werden."

 

English:

"Group property XXXXX can not be created or written with value type vbString."

 

Excel cells are formated as text. I've tried several possibilities to convert the readed cell entry, but nothing has worked.

 

Do anyone have some helpful information for me how to solve this problem?

 

Thanks in advance

 

Sven

 

0 Kudos
Message 1 of 7
(4,418 Views)

Hi Sven

 

In the help of "Add for Channels" the possible data types are listed. It must be one of these strings:  "DataTypeFloat64", "DataTypeDate", or "DataTypeString". So in your case you have to use "DataTypeString".

 

Hope this helps.

 

Winfried

0 Kudos
Message 2 of 7
(4,417 Views)

Thanks for answer!

Both data types are string, so it should be no problem to change it. Do you have any idea how to set the data type for the property as "DataTypeString"? I need to convert my string into this "DataTypeString".

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

Hi Sven

 

I tried your script with my excel table and it works without any problems. You can enter the format of the property as third optional parameter. Have checked that the strings are valid strings (you use a variable "L" in the Cell property)? Or try to convert the "strings" again to strings with the command CStr.

 

Winfried
0 Kudos
Message 4 of 7
(4,410 Views)

I tried as well using a new TDM-File without any group properties and it worked too. The error occours only, if I try to add an entry, which already exists (value was novalue). So I can avoid this problem by delete any group properties before create new ones.

 

Thanks again for help!

 

0 Kudos
Message 5 of 7
(4,408 Views)

Hi Sven,

If you omit the data type as the third parameter DIAdem tries to determine the format. You can not change the format of an existing  property with the method add. So create it with the correct format or delete each time you change the format.

 

Winfried

0 Kudos
Message 6 of 7
(4,406 Views)

I've written the property before while I debugged m scripts and I've not delete them. So I've add the property, filled with NoValue (because my Excel cell was empty), then I've tried to add them again, but this time filled with a string (because my Excel cell was NOT empty this time).Seems, that my problem occured because I've tried to change the data type of property by adding it again.

 

No I'm clear!

 

Thanks

 

0 Kudos
Message 7 of 7
(4,404 Views)