Pivoting table results so YearIDs become columns with all other data underneath them

The table above has all the data I need for my report, however, I need to pivot the table so that each YearID (based upon corresponding fkYear) is a separate column and the rest of the data in each row appears under the appropriate Year ID.  I'm trying
to pivot the table but I'm stuck on exactly how to do it.
RandyHJ1957

Ok, here is what I have so far as a PIVOT using a CTE
WITH ActiveAccountCodes AS
SELECT BWfkYear, BWYearID, BWFund, BWMajorObject, BWObject, BWObjectDescr, BWAmount, BWDescr FROM @TmpProposedAccountCodes
UNION
SELECT BWfkYear, BWYearID, BWFund, BWMajorObject, BWObject, BWObjectDescr, BWAmount, BWDescr FROM @TmpCurrentAccountCodes
UNION
SELECT BWfkYear, BWYearID, BWFund, BWMajorObject, BWObject, BWObjectDescr, BWAmount, BWDescr FROM @TmpBudget1AccountCodes
UNION
SELECT BWfkYear, BWYearID, BWFund, BWMajorObject, BWObject, BWObjectDescr, BWAmount, BWDescr FROM @TmpBudget2AccountCodes
UNION
SELECT BWfkYear, BWYearID, BWFund, BWMajorObject, BWObject, BWObjectDescr, BWAmount, BWDescr FROM @TmpBudget3AccountCodes
SELECT BWObject, BWObjectDescr, Proposed, Current, Actual1, Actual2, Actual3, BWDescr
FROM ActiveAccountCodes
PIVOT(SUM(BWAmount) FOR BWYearID IN ([SELECT BWYearID FROM @TmpProposedAccountCodes AS [Proposed]], [SELECT BWYearID FROM @TmpCurrentAccountCodes AS [Current]],
[SELECT BWYearID FROM @TmpBudget1AccountCodes AS Actual1],
[SELECT BWYearID FROM @TmpBudget2AccountCodes AS Actual2],
[SELECT BWYearID FROM @TmpBudget3AccountCodes AS Actual3] )) AS PVT
The error I am getting now is where I attempt to define the Proposed and Current column headings using a select statement to get the right YearID for the right year.  I get a red line under Proposed and Current in the main query above the PIVOT expression
RandyHJ1957

Similar Messages

  • MS SQL - Add column with all rows being "0"

    Add column with all rows being "0"

    nevermind
    "lee" <[email protected]> wrote in message
    news:e3b5kt$mch$[email protected]..
    > Add column with all rows being "0"
    >
    >
    >

  • Export / import tablespace with all objects (datas, users, roles)

    Hi, i have a problem or question to the topic export / import tablespace.
    On the one hand, i have a database 10g (A) and on the other hand, a database 11g (B).
    On A there is a tablespace called PRO.
    Furthermore 3 Users:
    PRO_Main - contains the datas - Tablespace PRO
    PRO_Users1 with a role PRO_UROLE - Tablespace PRO
    PRO_Users2 with a role PRO_UROLE - Tablespace PRO
    Now, i want to transfer the whole tablespace PRO (included users PRO_MAIN, PRO_USER1, PRO_User2 and the role PRO_UROLE) from A to B.
    On B, I 've created the user PRO_Main and the tablespace PRO.
    On A , i execute following statement:
    expdp PRO_Main/XXX TABLESPACES=PRO DIRECTORY=backup_datapump DUMPFILE=TSpro.dmp LOGFILE=TSpro.log
    On B:
    impdp PRO_Main/XXX TABLESPACES=PRO DIRECTORY=backup_datapump DUMPFILE=TSpro.dmp LOGFILE=TSpro.log
    Result:
    The User PRO_Main was imported with all the datas.
    But i 'm missing PRO_USER1, PRO_User2 and the role PRO_UROLE...
    I assume, i 've used wrong parameters in my expd and / or impdp.
    It would be nice, if anybody can give me a hint.
    Thanks in advance.
    Best Regards,
    Frank

    When you do a TABLESPACE mode export by specifying just the tablespaces, then all that gets exported are the tables and their dependent objects. The users, roles, and the tablespace definitions themselves don't get exported.
    When you do a SCHEMA mode export by specifying the schemas, you will get the schema definitions (if the schema running the export is privied) and all of the objects that the schema owns. The schema does not own roles or tablespace definitions.
    In your case, you want to move
    1. schemas - which you already created 1 on your target database
    2. roles
    3. everything in the tablespaces owned by multiple schemas.
    There is no 1 export/import command that will do this. This is how i would do this:
    1 - move the schema definitions
    a. you can either create these manually or
    b1. expdp schemas=<your list of schemas> include=user
    b2 impdp the results from b1.
    2. move the roles
    expdp full=y include=role ...
    remember, this will include all roles. If you want to limit what gets exported, then use:
    include=role:"in ('ROLE1', 'ROLE2', ETC.)
    impdo the roles just exported
    3. move the user information
    a. If you want to move all of the schema's objects like functions, packages, etc, then you need to use a schema mode
    export
    expdp user/password schemas=a,b,c ...
    b. If you want to move only the objects in those tablespaces, then use the tablespace export
    expdp user/password tablespaces=tbs1, tbs2, ...
    c. import the dumpfile generated in step 3
    impdp user/password ...
    Hope this helps.
    Dean

  • My iPad Mini with retina display suddenly will not connect to the Internet. It shows full wifi bars, yet no web pages will load. My Internet is working with all other apple devices in my house. The iPad also no longer works with celluar data.

    My iPad Mini with retina display suddenly will not connect to the Internet. It shows full wifi bars, yet no web pages will load. My Internet is working with all other apple devices in my house. The iPad also no longer works with celluar data. I'm not sure what has happened. It was working fine a few hours ago. I have tried resetting it, ive restarted my browser etc. I tried to erase all data from my Ipad but I can't do that because it needs to sign into my Apple ID and use the Internet!

    Some things to try first:
    1. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    2. Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    3. Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    4. Go into your router security settings and change from WEP to WPA with AES.
    5.  Renew IP Address: (especially if you are drooping internet connection)
        •    Launch Settings app
        •    Tap on Wi-Fi
        •    Tap on the blue arrow of the Wi-Fi network that you connect to from the list
        •    In the window that opens, tap on the Renew Lease button
    6. Potential Quick Fixes When Your iPad Won’t Connect to Your Wifi Network
    http://ipadinsight.com/ipad-tips-tricks/potential-quick-fixes-when-your-ipad-won t-connect-to-your-wifi-network/
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Fix WiFi Issue for iOS 7
    http://ipadnerds.com/fix-wifi-issue-ios-7/
    iOS 6 Wifi Problems/Fixes
    Wi-Fi Fix for iOS 6
    https://discussions.apple.com/thread/4823738?tstart=240
    How To: Workaround iPad Wi-Fi Issues
    http://www.theipadfan.com/workaround-ipad-wifi-issues/
    Another Fix For iOS 6 WiFi Problems
    http://tabletcrunch.com/2012/10/27/fix-ios-6-wifi-problems-ssid/
    Wifi Doesn't Connect After Waking From Sleep - Sometimes increasing screen brightness prevents the failure to reconnect after waking from sleep. According to Apple, “If brightness is at lowest level, increase it by moving the slider to the right and set auto brightness to off.”
    Fix For iOS 6 WiFi Problems?
    http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/
    Did iOS 6 Screw Your Wi-Fi? Here’s How to Fix It
    http://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bug
    How To Fix Wi-Fi Connectivity Issue After Upgrading To iOS 6
    http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading- to-ios-6.html
    iOS 6 iPad 3 wi-fi "connection fix" for netgear router
    http://www.youtube.com/watch?v=XsWS4ha-dn0
    Apple's iOS 6 Wi-Fi problems
    http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/
    ~~~~~~~~~~~~~~~~~~~~~~~
    iPad: Issues connecting to Wi-Fi networks
    http://support.apple.com/kb/ts3304
    How to Boost Your Wi-Fi Signal
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Boost-Your-Wi-Fi-Signal.h Mt
    Troubleshooting a Weak Wi-Fi Signal
    http://ipad.about.com/od/iPad_Troubleshooting/a/Troubleshooting-A-Weak-Wi-Fi-Sig nal.htm
    How to Fix a Poor Wi-Fi Signal on Your iPad
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Fix-A-Poor-Wi-Fi-Signal-O n-Your-iPad.htm
    iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    WiFi Connecting/Troubleshooting http://www.apple.com/support/ipad/wifi/
    How to Fix: My iPad Won't Connect to WiFi
    http://ipad.about.com/od/iPad_Troubleshooting/ss/How-To-Fix-My-Ipad-Wont-Connect -To-Wi-Fi.htm
    iOS: Connecting to the Internet http://support.apple.com/kb/HT1695
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Connect iPad to Wi-Fi (with troubleshooting info)
    http://thehowto.wikidot.com/wifi-connect-ipad
    10 Ways to Boost Your Wireless Signal
    http://www.pcmag.com/article2/0,2817,2372811,00.asp
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
    Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
    How To Fix iPhone, iPad, iPod Touch Wi-Fi Connectivity Issue http://tinyurl.com/7nvxbmz
    Unable to Connect After iOS Update - saw this solution on another post.
    https://discussions.apple.com/thread/4010130
    Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
    Some Wi-Fi losses may stem from a problematic interaction between Wi-Fi and cellular data connections. Numerous users have found that turning off Cellular Data in Settings gets their Wi-Fi working again.
    You may have many apps open which can possibly cause the slowdown and possibly the loss of wifi. In iOS 4-6 double tap your Home button & at the bottom of the screen you will see the icons of all open apps. Close those you are not using by pressing on an icon until all icons wiggle - then tap the minus sign. For iOS 7 users, there’s an easy way to see which apps are open in order to close them. By double-tapping the home button on your iPhone or iPad, the new multitasking feature in iOS 7 shows full page previews of all your open apps. Simply scroll horizontally to see all your apps, and close the apps with a simple flick towards the top of the screen.
    Wi-Fi or Bluetooth settings grayed out or dim
    http://support.apple.com/kb/TS1559
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

  • How do I convert an Adobe PDF file to Word on my Mac with all the data intact?

    How do I convert a scanned Adobe PDF file to Word on my Mac with all the data intact?

    http://www.macworld.com/article/1162699/how_to_convert_pdfs_to_word_and_other_fo rmats_.html
    https://itunes.apple.com/us/app/pdf-converter-free/id422540367

  • I have a brand new ipod touch and when setting it will not connect to my home wifi, even though it is working with all other devices

    I have a brand new, just out of the box, ipod touch that will not connec to my home wifi. The connection works with all other devices.

    What happens when you try to connect?
    Error messages?
    Does the iPod see the network?
    Have you tried other networks?
    See:
    iOS: Troubleshooting Wi-Fi networks and connections

  • My keyboard is not working in "Pages" but works with all other applications.  Please provide resolution advice.

    My keyboard is not working in "Pages" but works with all other applications.  Please provide resolution advice.

    What version of Pages?
    There are one or two of us here who are not intimately acquainted with your particular set-up.
    Peter

  • Why doesn't the rotate gesture on my trackpad behave as it used to for switching between tabs when it works the same with all other programs besides Firefox?

    Why doesn't the rotate gesture on my trackpad behave as it used to for switching between tabs when it works the same with all other programs besides Firefox?
    I changed the about:config to make the rotate gesture move between tabs, and it worked great for well over a year. Now it behaves erratically as described here:
    https://bugzilla.mozilla.org/show_bug.cgi?id=877598
    It used to be very controllable to move one tab over, now it is erratic and moves quickly and to unexpected tabs regardless of how slow I do the rotate gesture. This is the main reason I use Firefox over Chrome and I would like to continue to do so unless there is no fix to this.

    Just set the browser.gesture.twist.threshold to something around 15-25.

  • I can use iMessage with all iPhone uses except for ONE person.  That person can use iMessage with all other users, but not with ME.  What's the problem???

    I can use iMessage with all other iPhone users that I communicate with, except for ONE person.  When I send to that person, it always goes through as a text message.  This person can use iMessage with pther people, but when they send me a message, it always goes as a text.  Why can we both communicate with other people using iMessage, but not with one another?

    Hi Russell,
    1) If you have OD set up and "editor" has UID 1111, then when they log in to any machine that's bound to OD as editor, they will get UID 1111. Therefore, there won't be any of these permission errors. This is typically the recommended approach.
    2) I assume you mean "You'd prefer to not using open directory?" Whatever the case, OD isn't mandatory with Xsan -- it's just that with multiple user accounts, managing them centrally tends to be easier. For 3 or 4 accounts and 3 or 4 machines maybe it's no big deal. If you go larger, it could get a lot more complicated. That said, if you set it up such that each machine has the exact same set of users (as you said, Mary = UID 502, Fred = UID 503, William = UID 504), then you can do what you want. Mary can log in from multiple machines at the same time, and in general you won't have permissions problems. Of course, if you try and read and write the same file from multiple workstations at the same time, you will get file locking issues, which will prohibit somebody from successfully writing the file.
    File locking issues are different from general permissions errors. The former basically says "hey, someone else is editing this file. Therefore I won't let you edit it right now... you can read it if you want though." Permissions means somebody saves it, and Xsan thinks you saved it and own the file, when you really don't.
    Quad-Core PMG5, 4 GB RAM, 7800 GT, 1 TB disk.   Mac OS X (10.4.4)  

  • Detected use of SPRequest for previously closed SPWeb object. Please close SPWeb objects when you are done with all objects obtained from them

    HI
    i am keep seeing this message in ulsviewer of splogs in a webfront end server
    Detected use of SPRequest for previously closed SPWeb object.  Please close SPWeb objects when you are done with all objects obtained from them, but not before.  Stack trace:  
    at Microsoft.SharePoint.SPWeb.get_Exists()   
    at Microsoft.SharePoint.WebControls.CssLink.OnLoad(EventArgs e)   
    at System.Web.UI.Control.LoadRecursive()   
    at System.Web.UI.Control.LoadRecursive()   
    at System.Web.UI.Control.LoadRecursive()   
    at System.Web.UI.Control.LoadRecursive()   
    at System.Web.UI.Control.LoadRecursive()   
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   
    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   
    at System.Web.UI.Page.ProcessRequest()   
    at System.Web.UI.Page.ProcessRequest(HttpContext context)   
    at ASP._layouts_icc_icc_scan_view_aspx.ProcessRequest(HttpContext context)   
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)   
    at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)   
    at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)   
    at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)   
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)   
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)   
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)   
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
    adil

    Hi,
    Your SPweb object is not disposed properly.
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/3a25eb86-8415-4053-b319-9dd84a1fd71f/detected-use-of-sprequest-for-previously-closed-spweb-object-please-close-spweb-objects-when-you?forum=sharepointdevelopmentprevious
    http://sharepoint.stackexchange.com/questions/50793/detected-use-of-sprequest-for-previously-closed-spweb-object-after-spquery
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • How to reset the wiki server (MAC OS X 10.9 with OS X Server App Version 3) with all wiki datas only

    Hi,
    I need to reset my Wiki on MAC OS X 10.9 with OS X Server App Version 3, but without reinstalling the whole server app to configure all services.
    Does anybody knows how to reset the wiki server (MAC OS X 10.9 with OS X Server App Version 3) with all wiki datas only.
    Thanks a lot for your hints

    Hi Linc,
    sorry, I haven't saved the System-Logfile before restoring my parallels VM.
    But it looks like issues of linking data.
    For testing the Server services I have done a reset for a user password and I have deleted the profiles and configuration from Client-Side. One with Mac OS X 10.9.1, one iPad with iOS 6.1.3. But it was not possible to reconfigure/reinstall the Server Profile. Also a manually configuration was odd, because for some services the new password was necessary and for other services the old password. Very strange.
    To bring back the services I have rolled back the last snapshot of my parallels VM. Afterwards there was no probleme to reconfigure/reinstall the Profile on Client-Side (OS X 10.9.1 and iOS 6.1.3). Also the manually configuration shows the password for all services are matching with the current configuration.
    I'm going to install a further parallels VM with Mac OS X 10.9.1 and Server App 3 from scratch to move the services.
    Greetings

  • No web with safari, itunes, but can with all other apps.

    Hi
    I get no web connection with Safari and iTunes, but I can with all other apps. (Firefox, Entourage, Mail, Transmit-FTP)
    iTunes says: connection denied, Safari says: web page not found, but every other web app I have can connect.
    What gives?

    Hi,
    Do you have any proxies selected in your Network preferences?
    If so, try unselecting them and retry Safari/iTunes.

  • HT201269 i have got a ipod touch 4th gen and i have got minecraft pocket edition on it but i and getting a new ipod touch 4th gen and i would like to know how to get minecraft back on my new iPod touch with all my data on it??? please help

    i have got a ipod touch 4th gen and i have got minecraft pocket edition on it but i and getting a new ipod touch 4th gen and i would like to know how to get minecraft back on my new iPod touch with all my data on it??? please help

    See:
    iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device

  • ITunes does not recognize my CD/Rom Burner. The CD burner works with all other applications on my computer. How do I correct this?

    ITunes does not recognize my burner. The burner works perfectfully with all other applications. Anyone have any ideas?

    Hi scotty2hotty1972,
    Thanks for using Apple Support Communities.  This article has some steps you can try if iTunes isn't recognizing your optical drive:
    iTunes for Windows: Optical drive is no longer recognized, or "Disc burner or software not found" alert after install
    http://support.apple.com/kb/ts2308
    Cheers,
    - Ari

  • Detected use of SPRequest for previously closed SPWeb object. Please close SPWeb objects when you are done with all objects obtained from them, but not before.

    I have develop a custom solution for SharePoint Foundation 2010 that provide PDF documents filled with lists data and attachemnts.
    If the Customer run the solution to get the PDF we found in the ULS log following entry:
    03/07/2014 12:07:20.69  w3wp.exe (0x0B10) 0x18EC 
    SharePoint Foundation General                        90hv Unexpected 
    Detected use of SPRequest for previously closed SPWeb object.  Please close SPWeb objects when you are done with all objects obtained from them, but not before.  Stack trace:    at Microsoft.SharePoint.Utilities.SPUtility.GetLocalizedString(String
    source, String defaultResourceFile, UInt32 language)     at Microsoft.SharePoint.SPFieldCollection.get_DisplayNameDict()     at Microsoft.SharePoint.SPFieldCollection.GetFieldByDisplayName(String strDisplayName, Boolean
    bThrowException)     at Microsoft.SharePoint.SPFieldCollection.GetField(String strName, Boolean bThrowException)     at Microsoft.SharePoint.SPListItem.GetValue(String strName, Boolean bThrowException)    
    at Microsoft.SharePoint.SPListItem.get_Item(String fieldName)    
    at ECM_PDF_Excel.ListClicked.GetECOs(Dictionary`2 searchedEC... e918ecd4-7ed6-44bb-9e4f-d764586a2f79 ...RECONumber)    
    at ECM_PDF_Excel.PDF.Create()     at ECM_PDF_Excel.Layouts.ECM_PDF_Excel.ECMPDFExcel.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext
    context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr
    managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 f... e918ecd4-7ed6-44bb-9e4f-d764586a2f79
    03/07/2014 12:07:20.69* w3wp.exe (0x0B10)                        0x18EC SharePoint Foundation        
     General                        90hv Unexpected ...lags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr
    managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32
    flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)   e918ecd4-7ed6-44bb-9e4f-d764586a2f79
    We check the method
            /// <summary>
            /// Returns the ECOs in a Dictionary: ECO Number, Suffix
            /// </summary>
            /// <param name="searchedECRECONumber">Dictionary, with the search ECR/ECO Number</param>
            /// <returns>Dictionary ECO Number, Suffix</returns>
            public static Dictionary<string, string> GetECOs(Dictionary<String, String> searchedECRECONumber)
                SPSite siteContx = SPContext.Current.Site;
                SPWeb webContx = siteContx.RootWeb;
                Dictionary<string, string> listECOs = new Dictionary<string, string>();
                string ecoNumber = string.Empty;
                string ecoSuffix = string.Empty;
                if (searchedECRECONumber.ContainsKey(ConstantData.listClickedECONumberDictionary))
                    ecoNumber = searchedECRECONumber[ConstantData.listClickedECONumberDictionary];
                else
                    return listECOs;
                // Ich suche die ECO Nummber bei gegebener ECR Nummer
                // Ich brauche den Listen Namen der in den Spalten Realtion ECR Number & Realtion ECO Number einen Wert hat
                SPList dataList = webContx.Lists.TryGetList(ConstantData.listName_ECMExcelTemplateDataLists);
                if (dataList != null)
                    SPListItemCollection dataListItems = webContx.Lists.TryGetList(ConstantData.listName_ECMExcelTemplateDataLists).Items;
                    foreach (SPItem dataListItem in dataListItems)
                        Object relationECRColumnName = (String)dataListItem[ConstantData.listFieldName_ECMExcelTemplateDataLists_RelationECRNumber];
                        Object relationECOColumnName = (String)dataListItem[ConstantData.listFieldName_ECMExcelTemplateDataLists_RelationECONumber];
                        if (relationECRColumnName != null && relationECOColumnName != null)
                            // Ich habe den Listennamen gefunden in dem Spalten Realtion ECR Number & Realtion ECO Number einen Wert haben
                            string searchedListName = (String)dataListItem[ConstantData.listFieldName_ECMExcelTemplateDataLists_Title];
                            string searchedECOSuffixColumnName = (String)dataListItem[ConstantData.listFieldName_ECMExcelTemplateDataLists_RelationECONumber];
                            // Get the List from variable listName
                            listECOs = GetECOsDictionary(searchedListName, searchedECOSuffixColumnName, ecoNumber, relationECOColumnName);
                return listECOs;
    - What take we wrong?
    - How can we avoid this message?
    Regards
    Jonnyenglisch
    Ralf Happe - Christobal Colón N° 1 ES 07670 Portocolom Tel.: +34 6961 0375 7 @: [email protected] Skype: ralfhappe msm: [email protected] www.ralfhappe.com ralfhappe | soluciónes

    Here the code of GetECOsDictionary:
             /// <summary>
            /// Fill the dicionary with related ECO Numbers/Suffix
            /// </summary>
            /// <param name="searchedListName">String: the name of the list</param>
            /// <param name="ecoNumber">String: the ECO Number</param>
            /// <param name="relationECOColumnName"></param>
            /// <returns>Dictionary</returns>
            private static Dictionary<string, string> GetECOsDictionary(string searchedListName, string ecoNumber, Object relationECOColumnName)
                SPSite siteContx = SPContext.Current.Site;
                SPWeb webContx = siteContx.RootWeb;
                Dictionary<string, string> listECOs = new Dictionary<string, string>();
                SPQuery oQuery = new SPQuery();
                oQuery.Query = "<OrderBy>" +
                                    "<FieldRef Name='" + "Title" + "' Ascending='TRUE'></FieldRef>"
    +
                                "</OrderBy>" +
                                "<Where><BeginsWith>" +
                                    "<FieldRef Name='" + "Title" + "'/>" +
                                    "<Value Type='Text'>" + ecoNumber + "</Value>" +
                                "</BeginsWith></Where>";
                SPListItemCollection searchedListItems = webContx.Lists.TryGetList(searchedListName).GetItems(oQuery);
                foreach (SPItem searchedListItem in searchedListItems)
                    // Wenn die geclickte ECO Nummer gleich der Listen ECO Nummer ist dann setze die gefundene ECO Nummer
                    string foundECONumber = (String)searchedListItem[relationECOColumnName.ToString()];
                    string[] splitECONumber = foundECONumber.Split(ConstantData.splitBy_Slash);
                    if (ecoNumber == splitECONumber[0])
                        ecoNumber = splitECONumber[0];
                        if (splitECONumber.Count() == 1)
                            listECOs.Add(foundECONumber, "0");
                        if (splitECONumber.Count() > 1)
                            listECOs.Add(foundECONumber, splitECONumber[1]);
                return listECOs;
    Ralf Happe - Christobal Colón N° 1 ES 07670 Portocolom Tel.: +34 6961 0375 7 @: [email protected] Skype: ralfhappe msm: [email protected] www.ralfhappe.com ralfhappe | soluciónes

Maybe you are looking for

  • Voice memo sync with iphone4 IOS 5.1

    Dear all, I cannot sync my iphone 4 voice memos to itunes 10.6,  older voice memos, before FEB 2012, do  appear in voicememoms playlist in itunes but the newer ones do not. i am using ihone4 with IOS5.1 Can you help? ZAM

  • Auditing lob column changes when working with dbms_lob

    Hi, It seems that dml trigger doesn't fire when lob field is being updated using dbms_lob package. As it stated in Oracle documentation: "Using OCI functions or the DBMS_LOB package to update LOB values or LOB attributes of object columns does not ca

  • [(409)Conflict] on OCS10g File Upload

    When I upload a large file(over 100MB) to workspace, it occurs with an error message [(409)Conflict]. And, When I upload the file by WebDAV, it also occurs an error.

  • Podcast with wrong pictures

    When I play a podcast some of them have the wrong picture/icon with them. Others are fine. Also earlier today when I would play one it would just go back to previous menu. some of these had the blue ball in front and I know they have not been played

  • How do I get an XSKey replaced?

    How do I get a replacement for a defective XSKey?