Can't get API method to work

Can't get API method to work

cwhetten
Advisor Advisor
611 Views
3 Replies
Message 1 of 4

Can't get API method to work

cwhetten
Advisor
Advisor

I am trying to use the ContentTableColumn.GetPropertyMap method, but I can't figure out how to get it to work.  Here is the 2014 API help documentation on this method:

 

API article on GetPropertyMap.PNG

 

I have successfully accessed the ContentTableColumn object (stored in oMassColumn in the examples below), determined that HasPropertyMap = True, but every time I try to call GetPropertyMap, I get a type mismatch error.  I am trying to use this in an iLogic rule.  Here is what I have tried:

 

Dim setid As String
Dim propid As String
oMassColumn.GetPropertyMap(setid, propid)

I even tried this:

 

Dim setid As Object
Dim propid As Object
oMassColumn.GetPropertyMap(setid, propid)

 

Either the documentation is wrong, or there is some VB fundamental that I am not understanding here (which is entirely possible)...

 

Does anyone know how to successfully use this method?

 

Cameron Whetten
Inventor 2014

0 Likes
Accepted solutions (1)
612 Views
3 Replies
Replies (3)
Message 2 of 4

Boorda
Advocate
Advocate
Accepted solution

I havent tested this on your situation but I know that in the past VBA has some weird issues with syntax. 
For whatever reason, even if the code isn't highlighted red it throws errors. 

 

Sometime just changing the syntax a bit fixes the issue. Don't know if this will work in your case but try this....

 

   Change this... 

Dim setid As String
Dim propid As String
oMassColumn.GetPropertyMap(setid, propid)

 

   To this....

Dim setid As String
Dim propid As String
oMassColumn.GetPropertyMap setid, propid

 

Like I said, not sure if it will work for you but hopefuly it does....


Automation is key!
Message 3 of 4

cwhetten
Advisor
Advisor

Thanks for the suggestion @Boorda .  I tried it out and received a compile error: "Method arguments must be enclosed in parentheses."

 

I think your suggestion would be appropriate for VBA, but I am working in the iLogic rule editor.

 

But this gives me an idea.  I'll try this in a VBA macro instead of an iLogic rule, to see if that makes a difference.

 

Cameron Whetten
Inventor 2014

0 Likes
Message 4 of 4

cwhetten
Advisor
Advisor

I rewrote my iLogic rule into a VBA routine, and it worked (using the syntax that @Boorda suggested).  I still don't know why this method doesn't work in iLogic, but I was able to complete my task using VBA so I'll mark Boorda's post as the solution.  My actual usage is given below, for reference.

 

Dim setid As String
Dim propid As String
Debug.Print "Has Property Map = " & oMassColumn.HasPropertyMap

If oMassColumn.HasPropertyMap Then
    oMassColumn.GetPropertyMap setid, propid
    Debug.Print "Property Set = " & setid & vbNewLine & "Property ID = " & propid

End If

 

Cameron Whetten
Inventor 2014

0 Likes