on 2015 Aug 04 4:50 PM
I am new to PD scripting. I would like to add a new column to an existing key within a table. My code received an exeption message "Object creation can only be done through composition collections (Exception occurred. 0x80020009)."
Would someone post some sample code for me to plagarize? If not for adding a column to a key, something similar. (I have been successful in adding a new column to a table.) Frankly I am clueless how to do it. And I am having difficulty finding document for it.
Thanks for the help in advance.
This is an example:
You have a table called Audit and it has a column called Retest Number.
Also this table has a key called Pk Audit
You want to add column Retest Number to key Pk Audit
'Find the column you want to add
set model=ActiveModel
set table = model.FindChildByName("Audit", Cls_Table)
Set Columns =table.Columns
for each c in Columns
if c.name = "Retest Number" then
set myCol = c
end if
next
'Find the key and add the column
Set Keys = table.Keys
for each k in Keys
if k.name = "Pk Audit" then
set key_columns = k.columns
key_columns.add(myCol)
end if
next
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Phillip. It worked as you indicated. If I may, where can I find documentation like this so that I do not have to post a question everytime I try to do something new?
Thanks again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.