Home » Orchestrator » Orchestrator Data Manipulation Functions

Orchestrator Data Manipulation Functions

Orchestrator support a number of data manipulation functions. These functions can be used to manipulate string and  convert it into a usable form. You can also perform simple arithmetic operations, such as calculating sums and differences, and performing division and multiplication operations. For a complete list of the functions that you can perform see Technet. One nice thing about these data manipulation functions is that you can combine them.

Example, a simple text file

20130524_dataman01I use a Read Line activity to read the line, and I can then manipulate the data, in this figure I do that in a Send Platform Event activity

20130524_dataman02

The result will be

John Connor,Skynet,555-123456
John Connor
John
Jo
JO
555-123456
555
123456
124011

First line is the text line as in the text file. Then it is
String divided on “,” and showing first part
String divided on “,” and showing first part, then dividing that answer on ” ” and showing first part
String divided on “,” and showing first part, then dividing that answer on ” ” and showing first part, then showing two first letters from the left side
String divided on “,” and showing first part, then dividing that answer on ” ” and showing first part, then showing two first letters from the left side, then UPPER means converting that string to uppercase

About the numbers

String divided on “,” and showing third part
String divided on “,” and showing third part, then dividing that answer on “-” and showing first part
String divided on “,” and showing third part, then dividing that answer on “-” and showing second part
String divided on “,” and showing third part, then dividing that answer on “-” and showing first and second parts, then sum the two numbers

 

 

 

 


4 Comments

  1. Hi,
    You can use FIELD data manipulation function https://technet.microsoft.com/en-us/library/hh440537(v=sc.12).aspx to divide the line you get into for example FIRSTNAME and then LASTNAME. You can use the FIELD data manipulation function inside the create AD activity. Look at the reply from Stefan in https://social.technet.microsoft.com/Forums/en-US/b6f3870a-30ed-4937-849d-abe801d5b980/create-runbook-to-create-ad-user?forum=scogeneral , you can see how he subscribes to data from previous activities. The output he subscriptions to can be used in a FIELD function directly in the AD CREATE USER activity.

  2. Hi Anders,

    I am using a Query database activity to fetch records from a table. I get 5-10 records based on the select query. Each row has data that has to be processed. How can i fetch data from each column and publish it to the next activity.

    For e.g
    First Name Last Name Dept Location
    Sammy Zain IT London
    Carl benz IT US

    how can i use the first row to publish data to the next activity for creating AD account,

  3. Hi, in general, if you have a activity that can return 2000 answers I would not run it in a Orchestrator runbook due to scale and performance. A runbook cant really run in 2000 threads. If needed I might use SMA instead or keep that part to Powershell.

  4. Hi – I am basically doing an LDAP read from one system and generating over 2000 lines of values such as UID and DisplayName and then publishing the data as a Delimited string.

    To ensure that the data is publishing OK I “Append Line” to a .txt file and the data looks like this;

    Title;Userid;DisplayName

    Ie:

    Mr;JSMITH;John Smith

    I want to be able to use the data while it is still published in Orchestrator (rather than dump it into a text and then import CSV from the next powershell script) and then for example add all the “Userid’s” in the Published Data to an AD group etc or take the UserID and Displayname from the comma delimited string and add that to another system.

    Do I need to create a header for the Delimited data or can I create a Variable \ Published data and add it to the original Powershell script?

    My Runbook Looks like this;

    _________________________________________________________________________________________________
    Run.NET Script -> (This is where I set the Published Data “OutPut” String Variable

    ________________________________________________________________________________________________

    Next Linked Run.NET Script ->

    $Output = @()
    #Load the assemblies
    [Void][System.Reflection.Assembly]::LoadWithPartialName(“System.DirectoryServices.Protocols”)
    [Void][System.Reflection.Assembly]::LoadWithPartialName(“System.Net”)

    #Connects to LDAP Server via IP address
    $c = New-Object System.DirectoryServices.Protocols.LdapConnection “192.168.x.x”

    # Pick Authentication type:
    $c.AuthType = [System.DirectoryServices.Protocols.AuthType]::Basic

    # Gets username and password to use to execute LDAP query in ePASS.
    $user = “cn=UserLOGIN NAME”
    $pass = “PASSWORD”

    $credentials = new-object “System.Net.NetworkCredential” -ArgumentList $user,$pass

    # Bind login to XXX LDAP connection
    $c.Bind($credentials);

    $basedn = “o=XXX”
    $filter = “XXX”
    $scope = [System.DirectoryServices.Protocols.SearchScope]::Subtree

    #Attributes to return values on Userid, DisplayName and eVPNAccess=yes
    #$attrlist = ,”*”
    $attrlist = New-Object System.Collections.Specialized.StringCollection
    [Void]$attrlist.Add(“displayname”)
    [Void]$attrlist.Add(“evpnaccess”)
    [Void]$attrlist.Add(“cn”)

    $r = New-Object System.DirectoryServices.Protocols.SearchRequest -ArgumentList `
    $basedn,$filter,$scope,$attrlist

    #Process Response from LDAP Server
    $re = $c.SendRequest($r);
    $type_string = [System.Type]::GetType(“System.String”)

    foreach ($User in $re.Entries)
    {
    $string = $null
    foreach($attribute in $user.Attributes.AttributeNames)
    {
    $sn_string = $user.Attributes[$attribute].GetValues($type_string)
    foreach ($j in $sn_string)
    {
    $string += $j + “;”
    }
    }
    $Output += $string.trimend(“;”)
    }

    (Published Data “OutPut” String Variable)= $output”

    I have confirmed that the output is being generated but I want to access the Comma Delimited Data while it is published and also split the Delimited data so I can use it for different things.

    Ie:

    How do I translate my “Published Array Data” into something I can use in another activity within the same runbook. I need to be able to capture all the “UserID” in the published data

    Title;Userid;DisplayName

    Title;Userid;DisplayName

    Title;Userid;DisplayName

    Appreciate your time.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.