PowerShell: Update SharePoint multiple value lookup column?!

Hi.
I have some PowerShell scripts that access, update and insert data into various SharePoint 2010 lists. This all works nicely but there is one thing I'm having trouble with. I want to populate a lookup column in a list with multiple values. The column allows
multiple values and has many such records inserted manually - but I cannot do this using PowerShell. I can update the lookup column using a single "ID" lookup value - but not with multiple values.
I cannot find any documentation on how to do this using PowerShell. I have seen some examples (C#?) but there's little help in them.
Any suggestions?
Thank you,
Markus
Markus Sveinn Markusson

Well, being impatient in nature, I did a lot of browsing and searching - and finally found a solution that works for me - in this thread:
http://social.technet.microsoft.com/Forums/en/winserverpowershell/thread/3788a0ff-7011-4aea-bcc6-96a276a50e60. Adapted
to my code it looks like this:
$spAssignment = Start-SPAssignment
$spList = (Get-SPWeb -identity
http://site.domain.com -AssignmentCollection $spAssignment).Lists["Tickets"]
$spNew = $spList.Items.Add()
$spNew["Title"] = $Title
$spNew["Assigned To"] = $AssignID
$spNew["Description"] = $Descr
$spNew["Priority"] = $Priority 
#----- Begining of "solution"
$lookupentry1 = New-Object Microsoft.Sharepoint.SPFieldLookupValue(1,"Service 1")
$lookupentry2 = New-Object Microsoft.Sharepoint.SPFieldLookupValue(2,"Service 2")
$lookupentry3 = New-Object Microsoft.Sharepoint.SPFieldLookupValue(3,"Service 3")
$multientry = New-Object Microsoft.Sharepoint.SPFieldMultiChoiceValue($null)
$multientry.Add($lookupentry1)
$multientry.Add($lookupentry2)
$multientry.Add($lookupentry3)
$spNew["Service"] = $multientry
#----- End of "solution"
$spNew.Update()
Regards,
Markus
Markus Sveinn Markusson

Similar Messages

  • 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 |

  • Reporting counts on multi-value lookup columns

    Hi,
    I have a list containing 2 columns - student, and subjects. Subjects is a multi-value lookup column. Students may study multiple subjects. What I'm trying to achieve is a simple pie chart (I don't care if it's done using SharePoint Web Part, Excel or
    SSRS) that displays a breakdown of how many students are studying each subject.
    So if I have 2 list entries:
    Person 1, Science, Maths
    Person 2 , Maths
    Person 3 , Science
    The report/chart would report  2 Science and 3 Maths. What I'm struggling with is that because the data is stored in an un-normalized fashion ('#;') separated it's not possible to do straight charts without coding (C# or VBS). I
    would have assumed that this issue would be widely spread but I've had no luck looking through forums. Does anyone have any experience/;ideas on how to handle this??
    Thanks.
    MDB

    Hi
    From your description, my understanding is that you want to get counted values of a Multi-Value lookup column.
    You can get counted values of a Multi-Value lookup column
    in DVWP using XSLT.
    Refer to the following post:
    https://social.msdn.microsoft.com/Forums/en-US/f9d4cf16-4460-48a7-9514-dee19503b9fc/getting-counted-values-of-a-multivalue-lookup-column-in-dvwp-using-xslt?forum=sharepointdevelopmentprevious
    Best Regards,
    Lisa Chen
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Updating/setting multiple values in lookup field through powershell

    I'm trying to set multiple values to lookup column. I can get it to set one value but multiple values don't work
    see below
    [Microsoft.SharePoint.SPFieldLookupValueCollection] $itemValues = New-Object Microsoft.SharePoint.SPFieldLookupValueCollection
    [Microsoft.SharePoint.SPFieldLookupValue] $lookupvalue = New-Object Microsoft.SharePoint.SPFieldLookupValue
    $lookupvalue.LookupId = 1
    $lookupvalue.LookupId = 2
    $itemValues.Add($lookupvalue)
    $CMRSItems["Event Type"] = $itemValues
    $CMRSItems.Update()
    I was expecting the LookupID 1 and 2 to update but it doesn't. When i specify LookupId = 1 it works
    What am i doing wrong.
    Thanks in Advance

    Hi Patrick, 
    In your script above you're using the same object to set both ID's on. Setting the ID of $lookupvalue, then adding it to the lookupvaluecollection, before changing the ID value to 2, then adding that to the collection. 
    I wrote an article on setting fields using PowerShell, but it doesn't include multiple lookup values. It does contain multiple choice and taxonomy values though, which is a similar concept. It's here if you want to take a look: http://social.technet.microsoft.com/wiki/contents/articles/20831.sharepoint-a-complete-guide-to-getting-and-setting-fields-using-powershell.aspx
    Regards, Matthew
    MCPD | MCITP
    My Blog
    View
    Matthew Yarlett's profile
    See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • SharePoint 2013 Workflow Lookup Column Error

    When I try to use the value from a lookup column (e.g. display the selected value in the body of a email) in a SharePoint 2013 workflow I receive the following error. It works fine if I use the SharePoint 2010 workflow platform, but I always receive a error
    with 2013.
    First Error:
    Retrying last request. Next attempt scheduled in less than one minute. Details of last request: HTTP NotFound to http://portal.test.com/sites/Test/_vti_bin/client.svc/web/lists/getbyid(guid'00000000-0000-0000-0000-000000000000')/Items(10)?%24select=ID%2CLookupId%2CLookup%2FTitle&%24expand=Lookup
    Correlation Id: 3fb1bac9-f4b6-bbf1-a664-b3748668ea3c Instance Id: e7b4064d-029d-4a8b-9a75-7939f10e8817
    <script type="text/javascript">// <![CDATA[ var errorMessage = "Something went wrong. To try again, reload the page and then resume
    the workflow."; var dlg = null; function RetryWorkflow4(instanceName) { showDialog(); var ctx = SP.ClientContext.get_current(); var wfManager = SP.WorkflowServices.WorkflowServicesManager.newObject(ctx, ctx.get_web()); var instanceService = wfManager.getWorkflowInstanceService();
    var instance = instanceService.getInstance(instanceName); instanceService.resumeWorkflow(instance); ctx.executeQueryAsync( function(sender, args) { closeDialog(); theForm.submit(); }, function (sender, args) { closeDialog(); alert(errorMessage); } ); } //
    ]]> </script>
    Error from SharePoint Logs:
    Microsoft.SharePoint.SPException: List does not exist.  The page you selected contains a list that does not exist. 
    It may have been deleted by another user. ---> System.Runtime.InteropServices.COMException: List does not exist. 
    The page you selected contains a list that does not exist. 
    It may have been deleted by another user.     at Microsoft.SharePoint.Library.SPRequestInternalClass.GetListsWithCallback(String bstrUrl, Guid foreignWebId, String bstrListInternalName, Int32 dwBaseType, Int32 dwBaseTypeAlt,
    Int32 dwServerTemplate, UInt32 dwGetListFlags, UInt32 dwListFilterFlags, Boolean bPrefetchMetaData, Boolean bSecurityTrimmed, Boolean bGetSecurityData, Boolean bPrefetchRelatedFields, ISP2DSafeArrayWriter p2DWriter, Int32& plRecycleBinCount)
        at Microsoft.SharePoint.Library.SPRequest.GetListsWithCallback(String bstrUrl, Guid foreignWebId, String bstrListInternalName, Int32 dwBaseType, Int32 dwBaseTypeAlt, Int32 dwServerTemplate, UInt32 dwGetListFlags, UInt32
    dwListFilterFlags, Boolean bPrefetchMetaData, Boolean bSecurityTrimmed, Boolean bGetSecurityData, Boolean bPrefetchRelatedFields, ISP2DSafeArrayWriter p2DWriter, Int32& plRecycleBinCount)    
    --- End of inner exception stack trace ---    
    at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)    
    at Microsoft.SharePoint.Library.SPRequest.GetListsWithCallback(String bstrUrl, Guid foreignWebId, String bstrListInternalName, Int32 dwBaseType, Int32 dwBaseTypeAlt, Int32 dwServerTemplate, UInt32 dwGetListFlags, UInt32 dwListFilterFlags, Boolean bPrefetchMetaData,
    Boolean bSecurityTrimmed, Boolean bGetSecurityData, Boolean bPrefetchRelatedFields, ISP2DSafeArrayWriter p2DWriter, Int32& plRecycleBinCount)    
    at Microsoft.SharePoint.SPListCollection.EnsureListsData(Guid webId, String strListName)    
    at Microsoft.SharePoint.SPListCollection.ItemByInternalName(String strInternalName, Boolean bThrowException)    
    at Microsoft.SharePoint.SPListCollection.GetListById(Guid uniqueID, Boolean bThrowException)    
    at Microsoft.SharePoint.SPListCollection.get_Item(Guid uniqueID)    
    at Microsoft.SharePoint.SPListCollection.GetList(Guid uniqueId, Boolean fetchMetadata)    
    at Microsoft.SharePoint.SPListCollection.GetById(Guid uniqueId)    
    at Microsoft.SharePoint.ServerStub.SPListCollectionServerStub.InvokeMethod(Object target, String methodName, ClientValueCollection xmlargs, ProxyContext proxyContext, Boolean& isVoid)    
    at Microsoft.SharePoint.Client.ServerStub.InvokeMethodWithMonitoredScope(Object target, String methodName, ClientValueCollection args, ProxyContext proxyContext, Boolean& isVoid)    
    at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.InvokeMethod(Boolean mainRequestPath, Object value, ServerStub serverProxy, EdmParserNode node, Boolean resourceEndpoint, MethodInformation methodInfo, Boolean isExtensionMethod, Boolean isIndexerMethod)    
    at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.GetObjectFromPathMember(Boolean mainRequestPath, String path, Object value, EdmParserNode node, Boolean resourceEndpoint, MethodInformation& methodInfo)    
    at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.GetObjectFromPath(Boolean mainRequestPath, String path, String pathForErrorMessage)    
    at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.Process()    
    at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.ProcessRequest()

    Hi
    XantosX5 ,
    Thank you for your posting!
    According to your description, I try to reproduce your scenario in my SharePoint Server 2013 environment.
    I create a lookup column in a list and create a workflow 2013 for the list. In the workflow, I add Send an email action. Then I display the lookup column in the body of the email as the below figure:
    When I start the workflow, it works fine.
    Have you installed
    the workflow manager 1.0 cumulative update 1 ? It can be the point.  If not, please install it.
    Thank you for your understanding and support.
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • SharePoint Cross WebApplication Lookup Column

    I have created a custom lookup field. The column extends the default SharePoint Lookup column properties by adding extra fields in the custom editor control. The target is to create a lookup column based on any list available accross any web application
    in the farm. The problem is that after creating the column based on this field, in the newform.aspx or editform.aspx the the column is displayed with all the values in the lookup column dropdown but after saving, the lookup value is not getting stored. This
    happen only when the lookup list is in any other webapplication(or content database). If the list is in the current web application(content database) it works perfectly. I searched through google found through some article that lookup field has a limitation
    to work within a webapplication(content database). I Just want to confirm if this is the case or there is some workaround available. Below is a snap shot for my field editor control.
    reference :
    http://stefan-stanev-sharepoint-blog.blogspot.co.uk/2009/04/how-to-use-lookup-field-across.html

    Hi Anupam,
    If you want to do it programmatically, i suggest you create a custom field type:
    http://www.fewlines4biju.com/2011/04/how-to-create-custom-field-type-in.html
    Also, you can use SharePoint Choise field instead of Lookup field to achieve this. When you create a Choise field->go to SharePoint Designer->open the list newform.aspx/editform.aspx/dispform.aspx pages and modify them->create a data connection
    from SharePoint Designer to connect another web application list->set the dropdownlist datasource to the data connection
    http://office.microsoft.com/en-us/sharepoint-designer-help/create-a-custom-list-form-using-sharepoint-designer-HA010378258.aspx
    http://office.microsoft.com/en-ca/sharepoint-designer-help/add-a-database-as-a-data-source-HA010100908.aspx
    Thanks,
    Lhan Han

  • Powershell script to update a field value (recursively) in sharepoint form a .CSV file and not changing the updated by value

    need to run through a list of old to new data (.csv) file and change them in a sharepoint list - can not make it work
    here is my base attempt.
    $web = Get-SPWeb site url
    $list = $web.lists["List Name"]
    $item = $list.items.getitembyid(select from the items.csv old)
    $modifiedBy = $item["Editor"]
    #Editor is the internal name of the Modified By column
    $item["old"] = "new from the .csv file parsed by power sehll
    $ite.Syste,Update($false);
    $web.Dispose()

    Hi,
    According to your description, my understanding is that  you want to update SharePoint field value from a CSV file recursively.
    We can import CSV file using the Import-CSV –path command, then update the field value in the foreach loop.
    Here is a code snippet for your reference:
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    $csvVariable= Import-CSV -path "http://sp2010.contoso.com/finance/"
    # Destination site collection
    $WebURL = "http://sp2010.contoso.com/sites/Utility/"
    # Destination list name
    $listName = "Inventory"
    #Get the SPWeb object and save it to a variable
    $web = Get-SPWeb -identity $WebURL
    #Get the SPList object to retrieve the list
    $list = $web.Lists[$listName]
    #Get all items in this list and save them to a variable
    $items = $list.items
    #loop through csv file
    foreach($row in $csvVariable)
    #loop through SharePoint list
    foreach($item in $items)
    $item["ID #"]=$row."ID #"
    $item.Update()
    $web.Dispose()
    Here are some detailed articles for your reference:
    http://blogs.technet.com/b/stuffstevesays/archive/2013/06/07/populating-a-sharepoint-list-using-powershell.aspx
    http://social.technet.microsoft.com/wiki/contents/articles/25125.sharepoint-2013-powershell-to-copy-or-update-list-items-across-sharepoint-sites-and-farms.aspx
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • Is there a way to Insert Data into a Lookup Column Type on a SharePoint List Destination in SSIS?

    Greetings.
    I have successfully worked out inserting SQL data (2008 R2) into my 2010 SharePoint list (New, Update, Delete) by creating an SSIS Data Flow Task as outlined here:
    http://fsugeiger.blogspot.com/2010/01/synchronise-sql-table-with-sharepoint.html
    However, the problem I am running into is inserting data into the SharePoint Columns that are "Lookup" column types. I verified that all of the values I am copying from SQL into the SharePoint lookup column exist in the customn list it is pointing to. It
    is important to have this column be a lookup column as it links to another custom list that has many more columns of related information.
    I have read and re-read the SharePoint SSIS Adapters 2011.docx from
    http://sqlsrvintegrationsrv.codeplex.com/ and the only section that seems to apply is this:
    "Looking Up Values in a SharePoint List
    If you have to look up a value in a SharePoint list, you can use the Lookup transformation in your data flow, and use the SharePoint List source to load the lookup table. You may have to add a Derived Column transformation or a Script component that splits
    data in the lookup column on the ";#" delimiter to separate the ID value from the description.
    If you are replacing values in your data with the values that you look up in the list, then loading the changed data back into SharePoint, you only have to include the ID from the lookup column. SharePoint ignores the description if you include it."
    I am not sure if the above statement means that I should be passing the assocaited ID's other than the actual data into the SharePoint List destination. If that is the case, that will not really work as the lookup contains hundreds of rows. Not too mention
    I have several of these lookup column types pointing to several different lists.
    Any guidance in how I can put data into a SharePoint Lookup column type via Data Flow Task would be so much appreaciated.
    Thank you.
    My errors are:
    Error: 0x0 at Data Flow Task, SharePoint List Destination: Error on row ID="1": 0x1 - Unspecified error, such as too many items being updated at once (batch), or an invalid core field value.
    Error: 0xC0047062 at Data Flow Task, SharePoint List Destination [1903]: Microsoft.Samples.SqlServer.SSIS.SharePointListAdapters.PipelineProcessException: Errors detected in this component - see SSIS Errors at Microsoft.Samples.SqlServer.SSIS.SharePointListAdapters.SharePointListDestination.ProcessInput(Int32
    inputID, PipelineBuffer buffer) at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper100 wrapper, Int32 inputID, IDTSBuffer100 pDTSBuffer, IntPtr bufferWirePacket)
    Error: 0xC0047022 at Data Flow Task, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "SharePoint List Destination" (1903) failed with error code 0x80131500 while processing input "Component Input" (1912). The identified
    component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will

    I have found a solution to my problem and thought I would share it here in case there are others who are struggling with the above scenario. If you have a better way, I would love to hear about it since my way is a bit tedious.
    In a nutshell, in order to have an SSIS package put data from an OLE DB Source into a SharePoint List Destination Lookup Column, you need to pass the ID of the value that is being looked up, not the value that is in the “master” OLE DB source.
    Rough explanation, OLE DB Source value for column “Approp” is “4005” --> SQL matches “4005” with the ID in the new lookup table (“4005” = ID “5” as defined in the SharePoint lookup list) --> “5” gets passed into SharePoint List destination lookup
    column --> SharePoint displays “4005” and successfully links to the lookup list.
    Funny thing (not really), the error(s) outlined in my original post are not related in getting data into a SharePoint Lookup column as I am now successful in getting data into the system but I am still getting the same above error(s). I think it has to do
    with the ID column in the SharePoint list destination. What I can’t seem to figure out is why since I am not linking any data to that ID column (at least on new records). I am however linking it on Update and Delete and the errors mentioned above disappear
    and things work well.
    There are three tasks that need to get done in order to get data from SQL into a SharePoint lookup column assuming you have already set up your SharePoint lookup lists:
    1. Create new lookup table(s) in SQL that has the IDs from the SharePoint Lookup list and the values coming from the “master” OLD DB Source. You can see the ID column in SharePoint by toggling it on in a view.
    2. Create a SQL command that JOINs all the databases and tables so that the ID is passed and not the value into the SharePoint lookup column
    3. Change the “Data access mode” to “SQL Command” instead of the “Table or view” in the OLE DB Source and paste your command into the “SQL command text:” area.
    Other helpful info is that you may also need to add additional columns in the new lookup tables in SQL for the scenarios when the data is not unique. You can see this two times in my SQL command example for Units and JobTitles:
    SELECT
    pps.SSNm,
    pps.file_updated,
    pps.Employee_id,
    /* pps.CheckDistNm,*/
    Check_Distribution_id = COALESCE( d.ID, 0 ),
    pps.Job_nbr,
    pps.SeqNm,
    pps.action_eff_dt,
    Fund_id = COALESCE( f.id, 0 ),
    Appropriation_id = COALESCE( ap.id, 0 ),
    ActionCode_id = COALESCE( ac.id, 0 ),
    SpecNumber_id = COALESCE( jt.ID, 0 ),
    pps.Employee_id,
    /* pps.Fund,
    pps.Approp,
    pps.Unit,*/
    Unit_id = COALESCE( u.ID, 0 ),
    PosNm,
    PosCode,
    pps.LastName,
    pps.FirstName,
    pps.MI
    FROM
    x_PPS.aReportVw.pps_screens_active AS pps
    LEFT OUTER JOIN dbo.DistributionNumbers AS d ON
    pps.CheckDistNm = d.Check_Distribution
    LEFT OUTER JOIN dbo.Units AS u ON
    pps.Fund = u.Fund AND
    pps.Approp = u.Approp AND
    pps.Unit = u.Unit
    LEFT OUTER JOIN dbo.Appropriations AS ap ON
    pps.Approp = ap.Approp
    LEFT OUTER JOIN dbo.Funds AS f ON
    pps.Fund = f.Fund
    LEFT OUTER JOIN dbo.ActionCodes AS ac ON
    pps.ActionCode = ac.ActionCode
    LEFT OUTER JOIN dbo.JobTitles AS jt ON
    pps.SpecNm = jt.SpecNumber AND
    pps.JurisClass = jt.JurisClass

  • How to insert or update multiple values into a records of diff fields

    Hai All
    I have to insert or update or multiple values into a single records of diff fields from one to another table.
    Table1 has 3 fields
    Barcode bardate bartime
    0011 01-02-10 0815
    0022 01-02-10 0820
    0011 01-02-10 1130
    0022 01-02-10 1145
    0011 01-02-10 1230
    0022 01-02-10 1235
    0011 01-02-10 1645
    0022 01-02-10 1650
    these are the times that comes in at 0815 and goes break at 1130 and comes in at 1230 and goes home at 1645
    from these table i have to insert into another table called table2
    and the fields are barcode, date,timein intrin,introut,tiomout
    And the output want to like this
    barcode timein intrin introut timeout date
    0011 0815 1130 1230 1645 01-02-10
    0022 0820 1145 1235 1650 01-02-10
    If any give some good answer it will be help full..
    Thanks & Regards
    Srikkanth.M

    SQL> with table1 as (
      2  select '0011' Barcode,'01-02-10' bardate,'0815' bartime from dual union
      3  select '0022','01-02-10','0820' from dual union
      4  select '0011','01-02-10','1130' from dual union
      5  select '0022','01-02-10','1145' from dual union
      6  select '0011','01-02-10','1230' from dual union
      7  select '0022','01-02-10','1235' from dual union
      8  select '0011','01-02-10','1645' from dual union
      9  select '0022','01-02-10','1650' from dual
    10  )
    11  select barcode, bardate,
    12         max(decode(rn,1,bartime,null)) timein,
    13         max(decode(rn,2,bartime,null)) intrin,
    14         max(decode(rn,3,bartime,null)) introut,
    15         max(decode(rn,4,bartime,null)) timeout from (
    16                          select barcode, bardate, bartime,
    17                                 row_number() over (partition by barcode, bardate
    18                                                    order by bartime) rn
    19                            from table1)
    20  group by barcode, bardate;
    BARC BARDATE  TIME INTR INTR TIME
    0011 01-02-10 0815 1130 1230 1645
    0022 01-02-10 0820 1145 1235 1650Max
    http://oracleitalia.wordpress.com

  • Sort Order of Lookup Column

    I have a list with look-up columns. 
    In particular, 'Market' is a look-up column, pulling the 'Title' column from a document library.
    The issue I have is that the 'Market' look-up column contents are not listed in alphabetical order when selecting the menu to sort/filter, however, they are in alphabetical order
    in the library they are being pulled from.... 
    What controls the sort behavior of look-up column contents?
    UPDATE: I have discovered that, by grouping the View by any column, the error disappears. Although this might be a work-around and provide context to an eventual solution, this is not a solution. 
    UPDATE 2: The key seems to be multi-value columns OR System Column (TYPE), require grouping to display sort order correctly. 
    Filtering by the type column (Type = xls ~ 7 items) does
    NOT resolve the issue 
    Filtering by the type column (Type = xls ~ 7 items)
    AND Grouping by
    single-value lookup column (Year = 2012 ~4 items) does resolve the issue.
    Filtering by a single-value lookup column  (Year = 2012 ~ 1001 items) does resolve the issue 
    Filtering by a multi-value lookup column (Sector = Residential ~ 418 items) does
    NOT resolve the issue
    Filtering by a multi-value lookup column (Sector = Residential ~ 418 items)
    AND Grouping by
    single-value lookup column (Year = 2010 ~96 items) does resolve the issue.
    - Rick

    Here is a way that worked for me.  I had a lookup column from a list to a document library.  When I opened the form up it sorted by title.  I created a new Data Connection in Infopath editing the list.  When I created the Data connection
    it gave me options which fields in the data connection and the ability to sort based on a field.  I then just pointed my drop down list to point to the new data connection.  This worked on ipad as well as IE9.  No code required and my google
    searching did not find this simple solution so putting here.

  • How to store multiple values in a coloum for a particaular row?

    By mistake i posted this in abap general forum but i think this question should belong to Data Dictionary section
    I want to design a table where we can store a table where we can save multiple values of  column for a particular row. how to achieve this ? thanks in advance.
    Example
    id      name  val1    val2
    001  abc        1          a
                           2          b
                           3          d
                           4          e

    you can use deep structures to achieve this.
    or may be a simpilar approach based on the example that you have mentioned will be to create a table with all the primary keys that you want with an additional key field which will behave as a counter. some standard table do you this technique eg: PLMK where zaehl is a counter field which part of the kley fields.
    cheers, Prabhakaran

  • Setting default value for lookup column in Sharepoint 2013 via powershell

    Hi,
    when I try to use the 2010 version of setting a default value to a lookup column ( colum.defaultvalue="1;#Open"), this is not longer supported in SharePoint 2013. The defaultvalue is always the alphabetically sorted first entry in the source
    list.
    How can I change this?
    Thanks for any help.
     Lutz

    Hi Lutz,
    You can set the default value of a look-up column. The code is very simple, just need to take care of the code below.
    $w = Get-SPWeb http://web
    $l = $w.Lists["MyDocumentLibrary"]
    $lf = $l.Fields["lookupColumn"]
    $i = $l.Items[0] #List item to update
    $lf.ParseAndSetValue($i,"1;#lookupvalue") #1;#lookupvalue refers to the ID of the lookup item and the value of the lookup item.
    $i.Update()
    As another example, if I wanted to update all the items in my document library that had the lookup value
    Pending, with the lookup value Complete;
    $w = Get-SPWeb http://myweb
    $l = $w.Lists["MyDocumentLibrary"]
    $lf = $l.Fields["lookupColumn"]
    foreach($i in $l.Items)
    if($i["lookupColumn"] -eq "1;#Pending")
    $lf.ParseAndSetValue($i,"2;#Complete")
    $i.Update()
    Indul Hassan
    Microsoft Community Contributor
    http://www.indulhassan.com
    You Snooze.. You Lose !!

  • [Forum FAQ] SharePoint 2013: Extracting values from a multi-value enabled lookup column and merge values to a multi-value enabled column

    For some business requirements, users want to extract values from a multi-value enabled lookup column
    and add items to another list based on each separate value. In contrast, others want to find duplicate values in the list and merge associated values to a multi-value enabled column and then
    add items to another list based on the merged value. All of these can be achieved using SharePoint Designer 2013 Workflow.
    How to extract values from a multi-value enabled lookup column and add items to another list based
    on each separate value using SharePoint Designer 2013.
    Important actions: Loop Shape; Utility Actions
    Three scenarios
    Things to note
    Steps to create Workflow
    How to merge values to a multi-value enabled column and add item to another list based on the
    merged value using SharePoint Designer 2013.
    Important actions: Call HTTP Web Service; Build Dictionary
    Things to note
    Steps to create Workflow
    How to
    extract values from a multi-value enabled lookup column and
    add items to another list based on each separate value using SharePoint Designer 2013.
    For example, they have three lists as below. They want to
    extract values from the Destinations column
    in Lookup2 and add items to Lookup3 based on each country and set Title to current item: ID.
    Lookup1:
    Title (Single line of text)
    Lookup2:
    Title (Single line of text), Destinations (Lookup; Get information from: Lookup1 in Title column).\
    Lookup3:
    Title (Single line of text), Country (Single line of text).
    Important action
    1. Loop Shape: SharePoint Designer 2013 support two types of loops: loop n times and loop with condition.
    Loops must also conform to the following rules:
    Loops must be within a stage, and stages cannot be within a loop.
    Steps may be within a loop.
    Loops may have only one entry and one exit point.
    2. Utility Actions: It contains many actions, such as ‘Extract Substring from Index of String’ and ‘Find substring in String’.
    Three scenarios
    We need to loop through the string returned from the look up column and look for commas. There are three
    scenarios:
    1.  No comma but string is non-empty so there is only one country.
    2.  At least one comma so there is at least two or more countries to loop.
    3.  In the loop we have consumed all the commas so we have found the last country. 
    Things to note
    There are two things to note:
    1. "Find string in string (output to Variable:index)"  will return -1 if doesn't find
    the searched for string.
    2. In the opening statement "Set Variable: Countries to Current Item:Destinations" set the return
    field as  "Lookup Values, Comma Delimited".
    Steps to create Workflow
    Create a custom list named Lookup1.
    Create a custom list named Lookup2, add column: Destinations (Lookup; Get information from: Lookup1 in Title column).
    Create a custom list named Lookup3, add column: Country (Single line of text).
    Create a workflow associated to Lookup2.
    Add conditions and actions:
    Start the workflow automatically when an item is created.
    Add item to Lookup2, then workflow will be started automatically and create multiple items to lookup3.
    See the below in workflow History List:
    How to merge values to a multi-value enabled column and add item to another list based on the
    merged value using SharePoint Designer 2013
    For example, they have three lists as below. They want to find duplicate values in the Title column in
    Lookup3 and merge country column to a multi-value enabled column and then add item to lookup2 and set the Title to Current Item: Title.
    Lookup1:
    Title (Single line of text)
    Lookup3:
    Title (Single line of text), Country (Single line of text).
    Lookup2:
    Title (Single line of text), Test (Single line of text).
    Important actions
    "Call HTTP Web Service"
    action: In SharePoint 2013 workflows, we can call a web service using a new action introduced in SharePoint 2013 named Call HTTP Web Service. This action
    is flexible and allows you to make simple calls to a web service easily, or, if needed, you can create more complex calls using HTTP verbs as well as allowing you to add HTTP headers.
    “Build Dictionary"
    action:
    The Dictionary variable type is a new variable type in the SharePoint 2013 Workflow.
    The following are the three actions specifically designed for the Dictionary variable type: Build Dictionary, Count Items in a Dictionary and Get an Item from a Dictionary.
    The "Call HTTP Web Service" workflow action would be useless without the new "Dictionary" workflow action.
    Things to note
    The
    HTTP URI is set to https://sitename/_api/web/lists/GetByTitle('listname')/items?$orderby=Id%20desc and the HTTP method is set to “GET”. Then the list will be sort by Id in descending order.
    Use Get
    d/results(0)/Id form
    Variable: ResponseContent (Output to
    Variable: maxid) to get the Max ID.
    Use Set
    Variable: minid to Current List:ID to get the Min ID.
    Use Copy from
    Variable: destianation , starting at
    1 (Output to
    Variable: destianation) to remove the space.
    Steps to create Workflow
    Create a custom list named Lookup1.
    Create a custom list named Lookup2, add column: Test (Single line of text).
    Create a custom list named Lookup3, add column: Country (Single line of text).
    Create a workflow associated to Lookup3.
    Add a new "Build Dictionary" action
    to define the http request header:
    Add a Call HTTP Web Serviceaction, click on
    this and paste your http request.
    To associate the
    RequestHeader variable, select the Call action property,
    set the
    RequestHeaders property to
    RequestHeader:
    In the Call action, click on
    response and associate the response to a new
    variable: ResponseContent (of type Dictionary).
    After the Call action add Get item from Dictionary action to get the Max ID.
    Add Set Workflow Variable action to get the Min ID.
    Add Loop Shape (Loop with Condition) to get all the duplicate titles and integrate them to a string.
    Create item in Lookup2.
    The final Stage should look like this:
    Start the workflow automatically when an item is created.
    Add item to Lookup3, then workflow will be started automatically and create item to lookup2.
    See the below in workflow History List:
    References
    SharePoint Designer 2013 - Extracting values from a multi-value enabled lookup column into a dictionary as separate items:
    http://social.technet.microsoft.com/Forums/en-US/97d34468-1b53-4741-88b0-958472f8ca9a/sharepoint-designer-2013-extracting-values-from-a-multivalue-enabled-lookup-column-into-a
    Workflow actions quick reference (SharePoint 2013 Workflow platform):
    http://msdn.microsoft.com/en-us/library/jj164026.aspx
    Understanding Dictionary actions in SharePoint Designer 2013:
    http://msdn.microsoft.com/en-us/library/office/jj554504.aspx
    Working with Web Services in SharePoint 2013 Workflows using SharePoint Designer 2013:
    http://msdn.microsoft.com/en-us/library/office/dn567558.aspx
    Calling the SharePoint 2013 Rest API from a SharePoint Designer Workflow:
    http://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/

    GREAT info, but it may be helpful to note that when replacing a portion of the variable "Countries" with a whitespace character, you may cause the workflow to fail in a few specific cases (certain lookup fields will not accept this and will automatically
    cancel).  I only found this out when recreating your workflow on a similar, but much more complex list set.  
    To resolve this issue, I used another utility action (Extract Substring from Index of List) to clear out the whitespace.  I configured it as "Copy from
    Variable: Countries, starting at
    1 (Output to Variable: Countries), which takes care of this issue in those few cases.
    Otherwise, WOW!  AWESOME JOB!  Thanks!  :)

  • Updating a title column in list that is a lookup column to document library in sharepoint designer workflow 2010

    Hi I have a requirement to create a list item in Contracts List when a document is uploaded in Contracts Vendor library.
    Contracts List will
    have  columns - Contract Name ( title column), Contract Number, Contract Start date and end date.
    Contracts Vendor library will have Contract
    Name,Contract NUmber.
    User will select the Contract Name from drop down ( this is look up column linked to Contract Name in Contract
    List).When user uploads document in Contract Vendor library then item should be created in Contract List with selected Contract Name and
    Contract number .
    Contracts and Contracts Vendor are related by look up Contract Name. Contract Name is internally a title column in
    Contracts List.
    Issue1 :
    Since Contract number is look up column, while I am creating item the Contract name is not getting updated in
    Contracts List. I have to use sharepoint designer workflow to achieve this task. Title colum or Contract Name shows no title.
    Issue 2:
    One
    more issue I am facing is that Contracts List has Section and Division cascaded drop downs when i select values from section and division
    dropdowns and save item in Contracts list the values are getting saved in Contract List.
    Could anyone suggest me how to handle this ? I am
    attaching the screenshots of the list and library structure. TRuly appreciate your help.
    Below are screenshots of the list structure

    Hi,
    According to your post, my understanding is that you wanted to update a title column in list that is a lookup column to document library in sharepoint designer workflow 2010.
    I try to reproduce the issues as follows:
    Create a custom list named Contracts List, add columns: Contract Name ( title column), Contract Number(Number), Contract Start date(Data and Time) and Contract End date (Data and Time).
    Create a document library named Contracts Vendor library, add columns: Contract Name(Lookup), Contract NUmber(Lookup).
    Create a workflow associated to the Contracts Vendor library.
    Add action: Create List Item.
       5. Start the workflow automatically when an item is created.
       6. Upload a document, select the Contract Name and Contract NUmber, the workflow will be started automatically.
       7. Open the Contracts List, an item will be added with the Contract Name and Contract Number in the Contracts Vendor library.
    Thank you for your understanding.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Reading values from lookup columns through custom workflow in SharePoint 2013

    We are able to read the values of text, number columns through custom workflow (via coding) in SharePoint 2013. However, we are not able to read values from lookup columns. So, request anyone to provide help on this.
    Thanks & regards,
    Aditya

    Hi,
    According to your post, my understanding is that you want to read values from lookup columns through custom workflow in SharePoint 2013.
    Since the workflow just doesn't get lookup fields, let's give it something static to work with instead. If we can capture the ID of the lookup field and store that as a static value in our list, the workflow can happily use that to look up our related.
    For more information, you can refer to:
    SharePoint 2013 Workflows and Lookup Columns
    Thanks,
    Linda Li                
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

Maybe you are looking for

  • How to create pass-through-proxy?

    How do I create some kind of pass-through proxy that can listen and receive OCI, and then forward the commands to the oracle database (sometimes where the SQL is slightly altered). What is the best way to do this? I failed to find any relevant help i

  • BT Yahoo Premium Mail

    I recently moved my broadband and telephone service to another as I cannot get a date for availability of BT Infinity.  I received a letter from BT saying that my email account will be downloaded to the pay-as-you-go dial up service, which I will hav

  • I downloaded some new instruments and lost a great deal of my old ones

    I downloaded "additional content" and got excited that I saw so many more jampacks, etc. to add to my collection.  Unfortunately, I was shocked to discover that a great number of my original instruments were no longer available.  ( I'm in the middle

  • I can't airplay a video from my Ipad2 to AppleTV2 when ATV connected via Ethernet

    When i connect my ATV via WI-FI i have no issues but to have more speed i prefer Ethernet connection. It does work fine when i Mirror my Ipad2 but it doesn't let me play hd videos. Am i the only one ??

  • Use behaviour class to capture mouse motion

    Hi, I am trying to write a behavior class for mouse by extending the behavior class. But it does not seem to capture the mouse movement when I move the mouse. Here is my code. Plz help me to find out the problem. import java.awt.event.*; import java.