I want to copy just the last part of the Computer.Computer Location attribute to a new attribute, how do I do this?

Version 1

    Question:


    The Computer.Computer Location attribute has the Active Directory location of the computer.  I want to grab just the last part of the location and store it in a new attribute.  How do I do this?  

     

     

    Answer:


    This can be best handled with a Map Data rule using a vbscript to parse off the last part of the Computer Location attribute.  Follow these steps to create the rule: 

     

    1.  Right click on  Map Data  in the Data Translation Services console and select  New Rule.

    2.  Give it a  Name , in this example we will use  Computer Location  and click  Next.

    3.  Select  Computer Data  and click  Next.

    4.  Enter a new attribute as the  Database Attribute, in this case we will use  Computer.End Location, and click  Next.

    5.  Click  Add  to add a new source attribute.

    6.  Select the source attribute in the  Database Attribute , in this example it is  Computer.Computer Location , and click  Next.

    7.  Select  No Additional Requirements  and click  Next.

    8.  Leave the  Validation  string empty and click  Next.

    9.  Leave the  Groups  empty and click  Next.

    10. Click  Manual. 

    11. In the vbscript text box enter the following:


              retvalue = mid(value, instrrev(value, /)+1) 

     

    12. Click  Finish . 13. Click  Next . 14. Click  Finish . 

     

    You now have a rule to copy just the last part of the Computer.Computer Location attribute to the new Computer.End Location attribute.  By modifying the vbscript, you can change it to use a different part of the Computer Location attribute.