UMRA COM - Get/Set Data

8:39 PM / Comments (0) / by Tech Admin

If you haven’t already download the free trail version of User Management Resource Administrator here --> Download

If you want to learn the basics on how to connect to UMRA with its COM object, please see my original post on “Basics of UMRA COM”.In this post, I will show you some other cool features and tricks I was able to do after reading some of the UMRA COM object’s library.

So after my first post, I gave a basic example of how we connect to a UMRA project, but now we are going to take it a step further, and send the UMRA project we call with the COM object some variables, as well as get some variables back out of that same project.

So let’s get started shall we!We will first create a new “Automation Project”, and then add a “Set variable” action to the script.

Step 1 – Click File à New à Automation Project
Step 2 – Drag a “Set Variable” action onto the script Open tree Variable Actions à Variable Operation” à Set Variable
Step 3 – Double click on your “Set Variable Action” and configure it like below
A. Variable name: %my_umra_var%
B. Value of variable
a. Value: My Extra Text %text_from_webpage%
b. Type: text
C. Click Apply, then OK

Let me go ahead and explain what we just did. We have 1 variable (%my_umra_var%) in the script that we are going to get the value of . We also have 1 variable(%text_from_webpage%) that we are going to pass to the UMRA script.

Below is a screen shot of how your script should look once you’re at this step:


Ok perfect, we now have our UMRA script, we are now going to create a simple .ASP page that will connect to UMRA via the COM object “connect” method, and push data to our script, as well as pull data from the script.We will follow the same steps as in the previous blog, on how to connect to UMRA via it’s COM “connect” method, see this post here for code.Here is the sample code that will set and get data via the UMRA COM.

VB Script
'Create/Set
Variables

Dim
RetVal

Dim
UMRA_Server

Dim UMRA_
Port

Dim
My_Pulled_UMRA_Variable


UMRA_Server =
"MyServerName"

UMRA_Port =
56814

'End
Create/Set
Vairbales

Set Umra = Server.CreateObject("UMRAcom.Umra") ' Creates
a new reference to the UMRACom DLL

RetVal=Umra.Connect(UMRA_Server,UMRA_Port) ' Use the "Connect" Method, it
will
take 2 paramaters UMRA_Server and
UMRA_Port

'The
SetVariableText Method takes 2 paramaters (Your UMRA Variable Name, Your
Text)

Umra.SetVariableText "%text_from_webpage%","Add this text to my variable"

RetVal=Umra.ExecuteProjectScript(UMRA_Project) ' Use the
"ExecuteProjectScript Method, takes 1 paramater
UMRA_Project.

'The
GetVariableText Method works the same way as the Set, however we are now
getting
databack from UMRA AFTER the Project has
ran.

'The
GetVariableText has 2 paramaters (Your UMRA Variable Name You Want to
Get, Your
Variable You Want to Store the Data
In)

RetVal=Umra.GetVariableText("%my_umra_var%",My_Pulled_UMRA_Variable)

'Now that
we have the variable %my_umra_var% data stored in My_Pulled_UMRA_Variable we
can
now print it out to the
page

Response.write "My Pulled Value is:" &
My_Pulled_UMRA_Variable

If everything is done correctly, you will get a print out on the page saying “My Extra Text Add this text to my variable”. And there you go, you now just pushed data to UMRA COM and executed a project, and retrieved data from it. So what have we learned so far? We learned how to connect to UMRA via the COM with the “connect” method. We are now able to push/get data from UMRA projects. What next? In my next post I will show you have to loop through a table of data!

0 comments:

 
-->