Start a new topic

Import object in Global.vb

How do I access the Import object in Global.vb?

Specifically I want to use ApplyDictionary()

Do I need to pass the object to the function somehow or is it in some kind of session object?

I think I figured it out, but now how do I access my function from Profile.vb?

[code] Public Function DictionaryCheck(sKey As String,sDictionary As String, byval oImport As ImportOM.API.iImportSession) As String Dim sReturn As String = sKey sReturn = oImport.ApplyDictionary(sKey, sDictionary) If sReturn = sKey Then sReturn = "" End If Return sReturn End Function [/code]
So it looks like maybe I am not using this Global.vb correctly. I was hoping to make a helper function to use in all profiles, not a "virtual column". Does that work? Or can you only make virtual columns that can be used over multiple profiles?

As a side note, why are the functions we create in the API called "virtual columns" when they are just called functions in the rest of the interface? The button at the top of the code editor says "add virtual column" but really we are just adding a function that could be used on any column. It is confusing to refer to two very different things as virtual columns.

As with anything in programming, there are a couple ways to do this. The way I would suggest is to change your Public Function to Public Shared Function. Then you can access this code from within profile.vb by typing GlobalCode.DictionaryCheck. The other option requires you to declare an variable as a new GlobalCode object and then from that object call DictionaryCheck
That's it!

Login or Signup to post a comment