none
export to sql - splitting a string RRS feed

  • Question

  • In FIM, I have a department string attribute in the format deptNumber(space)|(space)deptName.

    example: 78596 | IT

    In exporting the data to sql table, I need to split the value into two different attributes deptNumber and deptName. I guess I have to do MV coding. Can someone help me how to do this through code please?

    Friday, May 9, 2014 8:11 PM

Answers

  • You can do this trough MA Extension coding. 

    Create a MA rules extension for SQL MA.

    http://technet.microsoft.com/en-us/library/jj590217(v=ws.10).aspx


    Extend the MapAttributesForExport method as follows. Assuming that you have department string in the metaverse attribute department and SQL columnNames are DEPTNAME and DEPTNUMBER.

            void IMASynchronization.MapAttributesForExport(string FlowRuleName, MVEntry mventry, CSEntry csentry)
            {
                switch (FlowRuleName)
                {
                    case "deptNumber":
                        if (mventry["department"].IsPresent)
                        {
                            csentry["DEPTNUMBER"].StringValue = mventry["department"].StringValue.SubString(0, mventry["department"].StringValue.IndexOf(" | "));
                            
                        }
                    case "deptName":
                        if (mventry["department"].IsPresent)
                        {
                            csentry["DEPTNAME"].StringValue = mventry["department"].StringValue.SubString(mventry["department"].StringValue.IndexOf(" | ") + 3, mventry["department"].StringValue.Length - (mventry["department"].StringValue.IndexOf(" | ") + 3));
                            
                        }    
    
    
                    default:
                        throw new EntryPointNotImplementedException();
                }
            }

    Then you need to make two outbound attribute flows on the SQL MA and refer to these through advanced mapping type- rules extension. 

    



    • Edited by Sameera_manMVP Saturday, May 10, 2014 2:52 AM
    • Proposed as answer by Dave Nesbitt Monday, May 12, 2014 8:41 AM
    • Marked as answer by fim_sc Tuesday, May 13, 2014 12:12 PM
    Saturday, May 10, 2014 2:50 AM