How to import multi-value reference with Granfeldt PowerShell MA?

Hi,
I am trying to import multi-value reference into FIM (Group object).
I can import all attributes from source SQL, except Multivalue reference (into members attribute on Group object).
I have defined schema like this:
$obj = New-Object -Type PSCustomObject
$obj | Add-Member -Type NoteProperty -Name "Anchor-axs_profid|String" -Value ""
$obj | Add-Member -Type NoteProperty -Name "objectClass|String" -Value "role"
$obj | Add-Member -Type NoteProperty -Name "name|String" -Value ""
$obj | Add-Member -Type NoteProperty -Name "member|Reference[]" -Value ""
$obj
On source attribute I have members defined in one attribute, divided by ",". 
Import script:
$Obj = @{}
$Obj.Add("objectClass", "role")
$Obj.Add("[DN]", "Role_"+$Object.$("axs_profid"))
$Obj.Add("axs_profid", $Object.$("axs_profid").ToString())
$Obj.Add("name", $Object.$("name").ToString())
if($Object.$("member").ToString() -ne "")
[string[]]$members = $Object.$("member").ToString().Split(',')
$Obj.Add("member", $members)
$Obj
When Full import is triggered, I get following error for roles with multiple users:
FIM Sync = staging-error
Event log = 
The server encountered an unexpected error in the synchronization engine:
 "BAIL: MMS(9588): d:\bt\32669\private\source\miis\shared\utils\libutils.cpp(7045): 0x8023040e (The distinguished name is invalid)
BAIL: MMS(9588): d:\bt\32669\private\source\miis\server\sqlstore\utils.cpp(229): 0x8023040e (The distinguished name is invalid)
BAIL: MMS(9588): d:\bt\32669\private\source\miis\server\sqlstore\nscsimp.cpp(5348): 0x8023040e (The distinguished name is invalid)
BAIL: MMS(9588): d:\bt\32669\private\source\miis\server\sqlstore\nscsimp.cpp(5753): 0x8023040e (The distinguished name is invalid)
BAIL: MMS(9588): d:\bt\32669\private\source\miis\server\sqlstore\nscsimp.cpp(686): 0x8023040e (The distinguished name is invalid)
BAIL: MMS(9588): d:\bt\32669\private\source\miis\server\sqlstore\csobj.cpp(12876): 0x8023040e (The distinguished name is invalid)
BAIL: MMS(9588): d:\bt\32669\private\source\miis\server\sqlstore\csobj.cpp(13976): 0x8023040e (The distinguished name is invalid)
BAIL: MMS(9588): d:\bt\32669\private\source\miis\server\sqlstore\csobj.h(1252): 0x8023040e (The distinguished name is invalid)
ERR_: MMS(9588): d:\bt\32669\private\source\miis\server\sync\syncstage.cpp(2018): ERR_: MMS(9588): d:\bt\32669\private\source\miis\server\sync\syncstage.cpp(612): ERR_: MMS(9588): d:\bt\32669\private\source\miis\server\sync\syncstage.cpp(647): Staging failed
0x8023040e: [21]ERR_: MMS(9588): d:\bt\32669\private\source\miis\server\sync\syncmonitor.cpp(2528): SE: Rollback SQL transaction for: 0x8023040e
Forefront Identity Manager 4.1.3559.0"
If I change the script to return only first member:
$Obj.Add("member", $members[0])
import is successfull and I can see referenced member in Group.
I have also tried to specify DN for both users and roles with the same outcome.
$Obj.Add("[DN]", "Role_"+$Object.$("axs_profid"))
I am using the latest version of  PSMA: 5.5
Thanks for your help guys!

I managed to solve this issue.
The problem was in string array (I always appended "," at the end of each value). MA then expected another value after the last comma.
The wrong approach:
[string[]]$members = $Object.$("member").ToString().Split(',')
The right approach:
[string[]]$members = $Object.$("member").ToString().TrimEnd(',').Split(',')

Similar Messages

  • How to use Special value set with Column clause to display addtional column

    hi
    can anyone tell me
    How to use Special value set with Column clause to display addtional column
    how can i use FND POPID and with COLUMN clause ?

    Dear Yaseen,
                To get the value in formula cumulative,after you have created the formula for that particular key figure,go to edit and click on tab "calculations".
    In that select overall result as 'count all values not equal to zero' and single result as 'count all values not equal to zero' .
    And mark the cumulative check box underneath.
    I hope you get the desired result and please do me favour .
    Sumit goomber

  • How To Import Into A Table with Multi-Value Fields

    Hello:
    I have a table with a multi-value field that contains states in which a company does business.  It is multi-value because there can be more than one state.  I tried to import a text tab-delimited file in which the data was arranged as follows:
    Field1 Tab Field 2 Tab OR, WA, CA Tab
    The "State field contained the multiple entries separated by a comma (like they appear in a query of the multi-value field), but it won't accept it.  Does anyone know how to import into a multi-value field?
    Thanks,
    Rich Locus, Logicwurks, LLC

    Joana:
    Here's the code I used to populate a multi-value field from a parsed field.  The parsing routine could be greatly improved by using the Split function, but at that time, I had not used it yet.   FYI... the field name of the multi-value field in
    the table was "DBAInStatesMultiValue", which you can see in the example below how it is integrated into the code.
    Option Compare Database
    Option Explicit
    Option Base 1
    Dim strInputString As String
    Dim intNumberOfArrayEntries As Integer
    Dim strStateArray(6) As String
    ' Loop Through A Table With A Multi-Value Field
    ' And Insert Values Into the Multi-Value Field From A
    ' Parsed Regular Text Field
    Public Function InsertIntoMultiValueField()
    Dim db As DAO.Database
    ' Main Recordset Contains a Multi-Value Field
    Dim rsBusiness As DAO.Recordset2
    ' Now Define the Multi-Value Fields as a RecordSet
    Dim rsDBAInStatesMultiValue As DAO.Recordset2
    ' The Values of the Field Are Contained in a Field Object
    Dim fldDBAInStatesMultiValue As DAO.Field2
    Dim i As Integer
    ' Open the Parent File
    Set db = CurrentDb()
    Set rsBusiness = db.OpenRecordset("tblBusiness")
    ' Set The Multi-Value Field
    Set fldDBAInStatesMultiValue = rsBusiness("DBAInStatesMultiValue")
    ' Check to Make Sure it is Multi-Value
    If Not (fldDBAInStatesMultiValue.IsComplex) Then
    MsgBox ("Not A Multi-Value Field")
    rsBusiness.Close
    Set rsBusiness = Nothing
    Set fldDBAInStatesMultiValue = Nothing
    Exit Function
    End If
    On Error Resume Next
    ' Loop Through
    Do While Not rsBusiness.EOF
    ' Parse Regular Text Field into Array For Insertion into Multi-Value
    strInputString = rsBusiness!DBAInStatesText
    Call ParseInputString
    ' If Entries Are Present, Add Them To The Multi-Value Field
    If intNumberOfArrayEntries > 0 Then
    Set rsDBAInStatesMultiValue = fldDBAInStatesMultiValue.Value
    rsBusiness.Edit
    For i = 1 To intNumberOfArrayEntries
    rsDBAInStatesMultiValue.AddNew
    rsDBAInStatesMultiValue("Value") = strStateArray(i)
    rsDBAInStatesMultiValue.Update
    Next i
    rsDBAInStatesMultiValue.Close
    rsBusiness.Update
    End If
    rsBusiness.MoveNext
    Loop
    On Error GoTo 0
    rsBusiness.Close
    Set rsBusiness = Nothing
    Set rsDBAInStatesMultiValue = Nothing
    End Function
    Public Function ParseInputString()
    Dim intLength As Integer
    Dim intStartSearch As Integer
    Dim intNextComma As Integer
    Dim intStartOfItem As Integer
    Dim intLengthOfItem As Integer
    Dim strComma As String
    strComma = ","
    intNumberOfArrayEntries = 0
    strInputString = Trim(strInputString)
    intLength = Len(strInputString)
    ' Skip Zero Length Strings
    If intLength = 0 Then
    Exit Function
    End If
    ' Strip Any Leading Comma
    If Mid(strInputString, 1, 1) = "," Then
    Mid(strInputString, 1, 1) = " "
    strInputString = Trim(strInputString)
    intLength = Len(strInputString)
    If intLength = 0 Then
    Exit Function
    End If
    End If
    ' Strip Any Trailing Comma
    If Mid(strInputString, intLength, 1) = "," Then
    Mid(strInputString, intLength, 1) = " "
    strInputString = Trim(strInputString)
    intLength = Len(strInputString)
    If intLength = 0 Then
    Exit Function
    End If
    End If
    intStartSearch = 1
    ' Loop Through And Parse All the Items
    Do
    intNextComma = InStr(intStartSearch, strInputString, strComma)
    If intNextComma <> 0 Then
    intNumberOfArrayEntries = intNumberOfArrayEntries + 1
    intStartOfItem = intStartSearch
    intLengthOfItem = intNextComma - intStartOfItem
    strStateArray(intNumberOfArrayEntries) = Trim(Mid(strInputString, intStartOfItem, intLengthOfItem))
    intStartSearch = intNextComma + 1
    Else
    intNumberOfArrayEntries = intNumberOfArrayEntries + 1
    intStartOfItem = intStartSearch
    intLengthOfItem = intLength - intStartSearch + 1
    strStateArray(intNumberOfArrayEntries) = Trim(Mid(strInputString, intStartOfItem, intLengthOfItem))
    End If
    Loop Until intNextComma = 0
    End Function
    Regards,
    Rich Locus, Logicwurks, LLC
    http://www.logicwurks.com

  • Insert Value(s) in Lookup Flat Multi-valued Table with Java API

    I've been looking in MDM Java API Library Reference Guide, MDM SP4 API JavaDoc, and SDN Forums for information on how to Insert/Update different values in a field in the Main Table of a given repository that belongs to a Lookup Flat Multi-valued Table using the Java API with no success.
    I also haven't been successful in adding this values in the same way that I'll add a single value, using the MDM Java API, in a single-value Lookup Table (a2iFields.Add(new A2iField(FIELD_CODE,FIELD_VALUE)) for each value I want to add, like for example:
    a2iFields.Add(new A2iField("Country","USA")
    a2iFields.Add(new A2iField("Country","Mexico")
    a2iFields.Add(new A2iField("Country","Germany")
    Can anybody point me to the correct documentation that I need to read to fulfill this task? Or, even better, if someone can post a piece of code, I'll be more thankful.
    Thanks for your help.

    HI,
    little code example, where you add existing lookup values based on there record id:
         int USA = 1;
                        int GERMANY = 2;
                        A2iValueArray countryArray = new A2iValueArray();               
                        countryArray.Add(new Value(USA));
                        countryArray.Add(new Value(GERMANY));
                        A2iFields record = new A2iFields();
                        record.Add(new A2iField("Country", new Value(countryArray)));
    Please reward points if helpful.
    Regards,
    Robert

  • Multi Value Parameter with ODBC Connection

    Hi Everyone . . .
    I am stuck, and have been since Monday :/ . . .
    Backgroud:
    I am using Report Builder 3.0 with an ODBC connection to build reports off of our Vertica DB.  This part is going swimmingly, thanks to the help I recieved from this forum.
    Now, some of the queries that I am using (or reports I guess) require parameters.  I was attempting the @Parameter and quickly realized this was not possible with the ODBC connection.  I have solved this issue by using the ? as the parameter. 
    Works nicely, not as clean, but serves the purpose.
    Most, all of my parameters to this point have been single value parameters.  Now, however, we are dabbling in allowing our report users to select multiple Users as a parameter.  This is where I am stuck...
    I have flipped the parameter checkbox to "Allow multiple values", I then recieved an error saying this: 
    Cannot add multi value query parameter 'UserName' for dataset 'RankingQuery' because it is not supported by the data extension.
    Here is what I have done:  I have gone to the Dataset properties for the appropriate query that the parameter is being fed into > then to the Parameters tab.  In the Parameters tab instead of selecting the @UserName parameter from the drop down
    I clicked the Fx buttone and inserted the UserName Parameter from there it looks like this: =Parameters!UserName.Value(0)
    Now because of this last step my report runs without error, however, when I select multiple user names from the parameter drop down I only recieve data for the first person selected in that drop down.
    Am I missing something?  Does anyone know how to fix this?  Please help!
    Thanks everyone.
    Travis

    Hi There
    Thanks for your posting. Can you please try this way? Go to your dataset properties and then go to filter tab and add filter like this
    Please choose your dataset filed name from the dataset in which you would like to apply the filter for your parameter
    UserName
    Put operator=in 
    And please put value like= Parameters!UserName.Value
    Please do not put Parameters!UserName.Value(0)
    I hope this will resolve your problem
    Many thanks
    Syed

  • How to pass multi-value input parameter to SQL command

    I'm having trouble following the threads related to passing multi-value parameters to a SQL command.
    I need more details on the work-around that exists for using a dummy main report to GET the input parameters and pass them to a subreport parameter that uses the input parameters in its sql command WHERE clause.
    So far the main report prompts user to enter badge numbers into a multi-value string type parameter field called badgeNumber.
    The main report getRequesters command executes the following SQL:
    SELECT requester FROM lawprod.requester WHERE lawprod.requester.requester IN  '{?badgeNumber}'
    order by requester
    The main report also contains a formula called requesterList that concatenates the input parameters and separates the values with commas:  (Join ({?badgeNumber}, ", ")  
    So if user enters badge numbers 1 and 2 and 3 the value of requesterList is 1, 2, 3
    From the main report I've used the Insert Subreport command to choose an existing report, and used the link tab to link @requesterList to ?requester; where ?requester is a multi-value parameter that is used in the subreport's SQL query as shown below:
    WHERE (lawprod.ictrans.update_date <=  {?endDate} AND
           lawprod.ictrans.update_date >= {?startDate} AND
           lawprod.ictrans.doc_type = 'IS' AND
           lawprod.ictrans.system_cd = 'RQ' AND
           lawprod.mmdist.posting_type = 'O1')
          AND
          (lawprod.ictrans.company = lawprod.mmdist.company AND 
           lawprod.ictrans.system_cd = lawprod.mmdist.system_cd AND
           lawprod.ictrans.location = lawprod.mmdist.location AND
           lawprod.ictrans.doc_type = lawprod.mmdist.doc_type AND
           lawprod.ictrans.document = lawprod.mmdist.doc_number AND
           lawprod.ictrans.shipment_nbr = lawprod.mmdist.doc_nbr_num AND
           lawprod.ictrans.line_nbr = lawprod.mmdist.line_nbr AND
           lawprod.ictrans.component_seq = lawprod.mmdist.component_seq)
          AND
          (lawprod.ictrans.company = lawprod.reqline.company AND 
           lawprod.ictrans.document = lawprod.reqline.req_number_a AND
           lawprod.ictrans.line_nbr = lawprod.reqline.line_nbr AND
           lawprod.reqline.company = lawprod.reqheader.company AND
           lawprod.reqline.req_number = lawprod.reqheader.req_number)
           AND
           (lawprod.reqheader.requester in '{?requester}')
    Following execution of the main report, Crystal appears to prompt for three values as expected: badge numbers for the main report, and start and end dates needed by the subreport.   I can't figure out why Crystal XI returns no data. Can anyone explain what I'm missing?
    Edited by: Patricia Sims on Sep 21, 2009 9:30 PM

    The reason no data is returned is that the multiple values are not (properly?) passed to the main report's SQL.  The main report's SQL should be (MS SQL):
    select 1 as dummy
    This causes exactly one record to be returned, which will basically be ignored (except the fact that it will drive the subreport; any query that returns only 1 record will suffice...).
    Change the concatenation of the selected values to be (basic syntax):
    formula = "|" + join({?badgeNumber}, "|") + "|"
    The leading and trailing vertical bars are important (otherwise a database value of 1 might match a selection of 123).
    Pass the concatenated string as the parameter value to the subreport.  In your subreport, select records on (basic syntax):
    formula = (instr({?sr-badgeParam}, "|"+cstr({requester},"0") + "|") > 0)
    (assumes is numeric in the database, and is integer; modify or eliminate cstr() if otherwise...)
    Put your subreport on the detail format of the main report, and you're all set...
    HTH,
    Carl

  • How to pass multi value selection parameter to SAP Function Module?

    Hi ,
    Anyone know how to pass CR multi value parameter - array to SAP Function module ?
    eg  multi selection of customer in CR
    and then pass to Function module
    in SAP FM,  the SQL select these customer only
    How should the import parameter / table of SAP Function module designed?
    and how should CR pass the data to SAP FM
    thx
    John

    Moved to Integration Kit forum

  • How to handle multi valued attributes

    Hi All,
    I am supposed to populate multivalued attributes for a field in oim resource profile. Lets assume the field is mailbox. The issue is that I am supposed to reconcile this field from the directory server during initial load. The mailboxes are fetched from the DS based on organization. For provisioning I have to get the mailboxes from the database and these mailboxes are based on the role a user has. At the time of provisioing, I am supposed to populate the mailbox field with values the user already has been provisioned with and also display the mailboxes that he can get access to. I have created the mailbox as a resource with id and name as two of its fields. Could someone please tell me how do I handle this?
    Thanks,
    Supreetha

    I am not sure if I could follow the same thing as mentioned in the link above. Here is my case, Role is a multi valued attribute which i need to handle in oim and is very different from the usual roles. For this purpose, I have created roles as a resource object with role_id as field in its process form.When an admin logs in to assign a new role_id, he should be able to see only those roles for assignment that the admin's org has. I have these org and role mappings in a custom table that I have created in the oim schema. How will I able to display only these available role_ids so that the admin can choose them and assign for the role resource.
    Could you please let me know how do I do the config in oim?
    Thanks,
    supreetha
    Edited by: Supreetha on Nov 13, 2010 2:54 AM

  • Import Multi-Value Picklists

    Hello,
    I believe it is not possible to import values to a multi-value picklist.
    Does anyone know if this is true??
    My requirement is to change an exisiting single picklist field to a new multi value field. So i've created the new field, but need to find a way to populate the data, short of doing 2000 records manually??
    Any ideas?
    Regards
    Minesh

    Hi
    It is possible to import multi-select picklist values in CRM OnDemand by following these steps:
    1. when creating the .csv file, make sure to separate the multiple values of the picklist by a semicolon.
    For example, if we have a multi-value picklist set up with various first names and we want to import 4 names into this field, we would enter each name separated by a semicolon. Of course these values would have to exist in the field setup.
    Account Name Location FirstName
    Test Account New York Will;Dan;Kory;Tim
    2. during the import, choose the Add New Value To Picklist option.
    Hope this will help you.
    Regards
    Nisman

  • How to make multi value parameter optional in SSRS

    I HAVE REPORT IN SSRS 2005.
    I have @strjournal as multi value parameter. Allow blank is checked. Parameter values r assigned through query.
    select jornalno,jornalno as descr from tran_table 
    union select 'NULL','NULL' 
    So for @strjournal,  valuefield = jornalno  , label field = descr
    my main query i am giving,
    select .... from myTable where  (TRANKEY IN (@strjournal) AND @strjournal<> 'NULL' ) OR (TRANKEY LIKE '%' AND @strjournal = 'NULL')
    If i select 'NULL' its giving me correct result (returning all records as condition is like '%')
    if i select only 1 journalno (not 'NULL') also giving me correct result (i.e. only 1 record for which jornalno is selected)
    if i select more than 1 jornalnos then its giving me error "an expression of non boolean type specified in a context where condition is expected , near ',' "
    Any help ??
    h2007

    I have report in SSRS 2005 with multi value parameter.
    @strjournal is multi value parameter. Allow blank is checked. Values r assigned by below query
    select journalno,journalno as descr from tranTable
    union
    select 'NULL','BLANK'
    so for @strjournal, value field = journalno and label field = descr
    My main query is,
    select ---- from mainTable where
    (TRANKEY IN (@strjournal) AND @strjournal<> 'NULL' ) OR (TRANKEY LIKE '%' AND @strjournal = 'NULL')
    if i select 'NULL' gives me correct result (returns all rows as condition is like '%')
    if i select only 1 journalno (not 'NULL') also gives me correct result (returns only 1 record for which journalno is selected)
    if i select more than 1 journal nos gives me error, An expression of non-boolean type specified in a
    context where a condition is expected, near ',' 
    if i select more than 1 values (though i have selected it as multi-value) its giving me error.
    if i just give condition, 
    select ---- from mainTable where (TRANKEY IN (@strjournal)) 
    then i can select multiple
    h2007

  • SharePoint 2013 Search: Instant Refinement of Multi-Value Properties with out clicking Apply

    Hi All,
    I will need help in modifying the Filter_Multivalue.htm file .
    The default multivalue refinement behaves as step 1 & 2.
    steps:1 When one configure a refinement as multi-value, the user is presented with the list of available filters with checkboxes
    Step:2The user must select one or more checkboxes and then click on the Apply link. After they click on the Apply link, the results are refined by the selected filters but only the selected filters are presented:
    Need solution for the below:
    Need an Instant Refinement solution, all filters are displayed all of the time and when the user clicks on a checkbox, the results are instantly refined without the need to click on an Apply link.
    Any one might have come a cross this scenairo , please share the code and details working steps.
    Thanks in advance.
    Regards,
    ajay

    Hi Ajay,
    According to your description, my understanding is that you want to make the refinement of multi-value properties without clicking Apply.
    I recommend to follow the steps in the link below to achieve the goal:
    http://stevemannspath.blogspot.com/2013/07/sharepoint-2013-search-instant.html
    With the Instant Refinement solution, all filters are displayed all of the time and when the user clicks on a checkbox, the results are instantly refined without the need to click on an Apply link.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • How to import column values into SharePoint 2013 Term Store Using Powershell(CSOM)

    Hi, 
    I do have SharePoint 2013 list with more than 500 items in it.Now I am trying to import column values into SharePoint 2013 Term Set A using Powershell scripts.
    I am new to Powershell(csom) and can anybody help me out to accomplish this task?
    Any help would be greately appreciated.
    Thank you,
    AA.
    AA.

    Hi
    check this doc
    http://wellytonian.com/2012/10/sharepoint-2010-2013-term-store-importer-using-csv/
    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

  • Issues updating/setting multi value lookup columns via powershell

    Hi All,
         I have an issue updating multi values in a lookup field via powershell
    I can update a single value  lookup field as below but can't get to update if its multi value.
    As stated below when I hardcode it. It works.
    No idea what 'm missing. Any help will be appreciated.
    #Hardcoded works below as you can see i'm setting 3 values
    $array = @($realval.Split(';'))
    for ($i = 0; $i -lt $array.Count - 1; $i += 2)
    $word = $array[$i].Trim('#')
    $number = $array[$i+1].Trim('#')
    "$number $word"
    $lookupvalue1 = GetLookUpValues -val $number
    [Microsoft.SharePoint.SPFieldLookupValueCollection] $itemValues = New-Object Microsoft.SharePoint.SPFieldLookupValueCollection
    [Microsoft.SharePoint.SPFieldLookupValue] $lookupvalue = New-Object Microsoft.SharePoint.SPFieldLookupValue
    [Microsoft.SharePoint.SPFieldLookupValue] $lookupvalue2 = New-Object Microsoft.SharePoint.SPFieldLookupValue
    [Microsoft.SharePoint.SPFieldLookupValue] $lookupvalue3 = New-Object Microsoft.SharePoint.SPFieldLookupValue
    $lookupvalue.LookupId = 1
    $lookupvalue2.LookupId = 2
    $lookupvalue3.LookupId = 6
    $itemValues.Add($lookupvalue)
    $itemValues.Add($lookupvalue2)
    $itemValues.Add($lookupvalue3)
    #$itemValues.Add($lookupvalue)
    $CMRSItems["Event Type"] = $itemValues;
    Write-Host "items:" $itemValues
    $CMRSItems.Update()
    # This works when its updating only one value but when it needs to update multivalue it only updates the last one
    #so for example with the lookupvalue above only 6 gets updated below
    $array = @($realval.Split(';'))
    for ($i = 0; $i -lt $array.Count - 1; $i += 2)
    $word = $array[$i].Trim('#')
    $number = $array[$i+1].Trim('#')
    #$number
    "$number $word"
    #send param to GetLoolValues func to return records as SPFieldLookupValue
    $lookupvalue1 = GetLookUpValues -val $number
    #I can view the lookupvalue returned successfully
    #Write-Host $lookupvalue1
    [Microsoft.SharePoint.SPFieldLookupValueCollection] $itemValues = New-Object Microsoft.SharePoint.SPFieldLookupValueCollection
    #This LookupId returns 3 values like on the hardcoded one above like so :1,2,6
    $lookupvalue.LookupId = $number
    $itemValues.Add($lookupvalue)
    $CMRSItems["Event Type"] = $itemValues;
    #I can view the items returned successfully
    Write-Host "items:" $itemValues
    $CMRSItems.Update()

    The problem I can see with your code is that the below line of code, you are instantiating inside the for loop. This should have been outside the for loop as by keeping it inside the loop you are overriding the value.
    [Microsoft.SharePoint.SPFieldLookupValueCollection] $itemValues = New-Object Microsoft.SharePoint.SPFieldLookupValueCollection
    Please have a look at the below solution and modify your code as per your requirement. What I am trying to achieve in the below code is that I have a listA in which one of the field is being used as a multi-lookup in my listB.
    $lookupCollection = $something.split(";")
    $LookupMasterList=$web.Lists["ListA"]
    [Microsoft.SharePoint.SPFieldLookupValueCollection] $lookupValueCollection = New-Object Microsoft.SharePoint.SPFieldLookupValueCollection
    #Get the Lookup Item from Parent List
    foreach($item in $lookupCollection){
    IF([string]::IsNullOrEmpty($item.trim())) {
    continue;
    $LookupItem = $LookupMasterList.Items | Where-Object { $_.Item("FieldInternalName") -eq $item.trim()}
    if($LookupItem -ne $null)
    $myLookup = New-Object Microsoft.Sharepoint.SPFieldLookupValue($LookupItem.ID,$item.trim())
    $lookupValueCollection.Add($myLookup);
    #Set the Lookup field value
    if([string]::IsNullOrEmpty($lookupValueCollection)){
    continue;
    else{
    $newItem["Lookupfieldinternalname"] = $lookupValueCollection
    The above logic has no hard coding and it fetches the lookup information directly from the master list and generates a collection based on that. You can modify the above code as per your requirement.
    Geetanjali Arora | My blogs |

  • How to fetch data where reference with two values

    Hello Gurus,
    How to fetch data from database table with two values for reference. like
             SELECT  < FIELDS>
                              FROM <DB>
                              INTO TABLE TAB2
                              FOR ALL ENTRIES IN
                              TAB1
                              WHERE
                               FIELD1 = TAB1-FIELD1 AND
                               FIELD1 =  TAB1-FIELD2.

    Hi,
    If you want to get data for both fields then Instead of AND use OR
            SELECT  < FIELDS> 
                              FROM <DB>
                              INTO TABLE TAB2
                              FOR ALL ENTRIES IN
                              TAB1
                              WHERE
                               FIELD1 = TAB1-FIELD1 OR
                               FIELD1 =  TAB1-FIELD2.
    Or if you want that only common data for both fields should be fetched then create new internal table. Append data of both fields into that table. Sort new table and do delete adjust duplicate. Now use new internal table in your select query.
    Let me know if this helps.
    Regards,
    Jigar Thakkar.

  • How to create multi axis graph with 2 on change of fields and 2 values

    Hi all,
    i am working for a Semi conductor company and I have been madated to evaluate Crystal report 2008 in order to include it in our legacy software.
    So I have tested the soft and it seems to fit to our need.
    But I have a question...
    Here is a scenario i want to create in crystal but I have an error message..
    Can you please tell me if twant I want to achieve is feasisible...and if so how ?
    Thank you
    I would like to create a percent bar chart that contains 2 on change of fields and 2 show values.
    The idea behind in then to have a mutli axis chart in order to print as a line the second values.
    So the first values will be my bar chart in percentage and the second value will be a sum.
    Hope my description is cleat...
    Thank's in advance for your support...
    Have a good day

    There are different ways to achieve that. The simplest i could recall is to have 2 different charts, 1st bar chart and 2nd a line chart, lay one over the other and enable the transparency on the chart which on Top ( say Line ). also, crystal will allow you to control axes etc and make them transparent..

Maybe you are looking for

  • Report Artist Listing Error

    I found is misslabled track in iTunes.. Where and how do I report it? I the artistname (which is a musician) isnt correct and when I click it it leads me to an commedian. Would be a bad thing if someone bought the track and it's not what they expecte

  • FlexUnit CI - Flash Player linux installation

    I am now attempting to do some CI testing with the FlexUnit Ant task on the Linux platform, specifically RHEL 6 (x64). I am finding the installation of the Linux debug stand-alone player not as straight-forward as I had hoped. I finally found using g

  • Transition between two movies

    I would like to add a transition between two movies in the following AS3 script that otherwise works fine. Any help is appreciated: package { import flash.display.MovieClip; import flash.net.URLLoader; import flash.net.URLRequest; import flash.events

  • Cast was not declared in scope

                            Set::View setResults = theCache->entrySet(EqualsFilter::create(vPsngSmryExtractor, psng_smry_id));                         for (Iterator::Handle iter = setResults->iterator(); iter->hasNext(); )                                

  • How do I make more storage on my iPod?

    How do I make more room in the "other" section of my storage? I want to rent a movie and they keep saying I don'y have enough room to download it. I checked iTunes and the most packed section of my storage is the 'other' catagory. How do I clear it?