Sort order in list wrong: in CAML and in view

Hello,
When I order my list with document sets by ID, the order is wrong. It is wrong in the list and with caml.
This is my view (I just set the sort on the ID column):
The first 4 objects are created by the Client Object Model; the last 4 are created by a SharePoint webpart that I developped myself...
My code for creating document sets in COM is something like this:
ListItemCreationInformation newItemInfo = new ListItemCreationInformation
UnderlyingObjectType = FileSystemObjectType.Folder,
LeafName = _strLeafname // = date in format YYYYMMDDhhmmss
ListItem newListItem = myList.AddItem(newItemInfo);
newListItem["ContentTypeId"] = targetDocumentSetContentType.Id.ToString();
newListItem["Title"] = title;
newListItem.Update();
clientContext.Load(myList);
clientContext.ExecuteQuery();
The code in the webpart is this:
SPContentType docsetCt = myLst.ContentTypes[p.GetFromResourcefile("xxxxxxxxxxxxxx")];
Hashtable properties = new Hashtable
{"DocumentSetDescription", ""},
{"Title", txtTitle.Text}
SPFolder parentFolder = myLst.RootFolder;
int newId = GetLastId(myLst) + 1;
DocumentSet ds = DocumentSet.Create(parentFolder, newId.ToString(CultureInfo.InvariantCulture), docsetCt.Id, properties, true);
ds.Item["Title"] = title
ds.Item.Update();
why is the sort order wrong?
if i do this query in the U2U Caml builder, the order is also wrong
<OrderBy><FieldRef Name='ID' Ascending='FALSE' /></OrderBy>
if i order by "created", the order is also wrong....
i don't get it....

Document Sets are great tools for grouping multiple documents together. However, if every set has exactly one document, it would be better to just upload the file and not place it within a Document Set:
Uploading documents using object model - http://msdn.microsoft.com/en-us/library/office/ms454491(v=office.14).aspx
Uploading documents using web services -
http://cecildt.blogspot.com/2010/10/upload-documents-to-sharepoint-2010.html
If you have requirements to use Document Sets, keep in mind that this adds a layer of complexity beyond a simple Document Library. Behind the scenes, each Document Set is treated as a separate folder, and although can you query items within it, there might
be extra steps for getting the sort order to ignore the folder structure. Can you try setting the Scope to be "Recursive" and also specify that you are looking only for files and not folders:
<Eq><FieldRef Name='FSObjType'/><Value Type='Lookup'>1</Value></Eq></Where>
Dimitri Ayrapetov (MCSE: SharePoint)

Similar Messages

  • How to keep sort order in Shuttle item's source and destination boxes?

    I have defined a shuttle item on a page and the list of values in the source box is populated by a SQL with sort order specified. In the Settings of the shuttle item, Show Controls value is set to Moving Only instead of All. When a user moves selected values from the source box to the destination box or vice versa, the list of values does not maintain the original sort order. For example, if I have 26 values A through Z, a user can put value Z before A in the destination box. And when a user move A from the destination box to the source box, A is the last item in the source box. The reset button clears everything in the destination box and resets the source box to the original sorted list. This is not the solution that I am looking for. I would like to see the items in the source and destination boxes to maintain their original sort order all the time.
    Is it possible?
    APEX v4.0.1.00.03
    Oracle 11g (v11.2.0.1.0)

    Hi,
    See if this post help
    Re: Sort Shuttle Right
    Regards,
    Jari

  • User_catalog - object listed as both 'TABLE' and 'MATERIALIZED VIEW'

    SELECT * FROM USER_CATALOG ORDER BY OBJECT_NAME
    returns ...
    OBJECT_NAME              OBJECT_TYPE       
    BLOBBY                   SYNONYM           
    BONUS                    TABLE             
    DEPT                     TABLE             
    EMP                      TABLE             
    EMPLOYEES                SYNONYM           
    EMPWITHDEPT              MATERIALIZED VIEW 
    EMPWITHDEPT              TABLE             
                             ^^^^^^^^^^^^Any ideas to show only the 'MATERIALIZED VIEW' row for the above query?
    Thanks in advance,
    Mike Norman

    So, I would need some sort of logic to
    check if the OBJECT_NAME from user_objects
    is present in user_snapshots print 'MATERIALIZED VIEW'
    otherwise take the OBJECT_TYPE from user_objects -
    some sort of DECODE?

  • Thunar wrong sort order

    Today after installing arch on my laptop i noticed that the sort order of my files and folders in thunar are wrong. I made a little test folder:
    The order of the folders in the test folder don't change when I change the sort order but in other folders the sort order is reversed but the folders and files are not sorted.
    Has someone the same Problem or a fix for it?

    BrainWorker wrote:
    AaronBP wrote:They notice because they are in the CC list. Whenever a new comment comes in they get an email. You should not open a new bug if there's already one open about it.
    I don't really care if they are going to complain about it or not. My goal is to make them pay attention to this bug, because I think it is nicely forgotten.
    This is open source, bro. You can't make anybody do anything, but you might encourage some admin to ban you if you willfully break rules. If you can't break open the source and fix the problem yourself (which is surely the most speedy solution!), you're better off following community procedures and being as helpful as possible. Otherwise you'll just be excluded and ignored.

  • Category List/Tree View Sort Order

    What determines the sort order for the folders in the Category/Tree view Lists?
    I have two machines both at SP1 FP3, one displays Favorites and then Add-Ons, the other displays Favorites and then Charts, with Add-Ons coming at the bottom of the list.
    Any ideas, another registry fix?
    Thanks
    Charles

    Hi pianoboyCoder,
    You could loop the treeNodes in the treeView. then move the Node whose text begin with "Red" to bottom.
    I wrote a test program for you. you could refer to .
    int upper = this.treeView1.Nodes.Count;
    TreeNode Temp;
    for (int Outer = upper-1; Outer >= 1; Outer--)
    for (int Inner = 0; Inner <= Outer-1; Inner++)
    if (treeView1.Nodes[Inner].Text.StartsWith("Red"))
    Temp = treeView1.Nodes[Inner];
    treeView1.Nodes[Inner] = treeView1.Nodes[Inner + 1];
    treeView1.Nodes[Inner + 1] = Temp;
    If you have any other concern regarding this issue, please feel free to let me know.
    Best regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Sort Order for Legend and X Axis

    Does anyone know of a way to keep a specific sort order for both the X Axis and the Legend. Both start with numbers and I can get one or the other to sort correcly on the chart but not both. Biggest problem is not all of the legend items are in the first X Axis item so the colors change on the bar graph depending on the legend items in the first X Axis item.

    If you tie bar colors with values, how you will differentiate the bars for different legends.
    Take an example, there are three columns Employee, Location and salery have following values
    Employee Location Salery
    A London 30000
    B Chicago 40000
    C London 50000
    D Chicago 60000
    if we keep Location as Legend and Employee in X Axis, and sort Legend first then Employee. Set Blue for Chicago and Red for London, First two blue bars for A and C will be displayed and then two red bars for B and D will be displayed. Order in X axis will be A,C,B and D. This is not in sequence but this is the way it will and it should work. If you sort by Employee instead if Location, you will get sequence in X axis, but the same colored bars wont be together.
    Thanks
    Swami

  • Sort Order in Smart Playlist iTunes 9.1

    Now that I've upgraded to 9.1 I am finding that the sort order is gone wrong in Smart Playlists. What is happening is that artists are being sorted by their first name rather than by their last name regardless of what I have entered in Sort Artist field.
    However, the sort works as it should in the Library list.
    So, using Paul McCartney as an example; I have in the Artist field *Paul McCartney*, in the Sort Artist field I have *McCartney Paul*. When I view my music in the Library list he is sorted under M. But when I view my music in a Smart Playlist he is sorted under P.

    First give the list a "kick" by sorting by some other fields, closing and reopening iTunes, and then sorting again by Artist.
    Also look at the Sorting tab and make sure the tracks do not have data that could be interfering with the Sort Artist, namely Sort Album Artist.
    If neither of those helps, you have probably discovered a bug in 9.1, which you can report here:
    http://www.apple.com/feedback/itunesapp.html

  • Genre sort in Browser, auto sync, sort order

    I just updated to 3.1.1 and iTunes 9.0. Now Genre is missing in the browser. How can I get it back? Also none of my playlist sync in auto. I have to manually manage it. I rarely use it for music, just for listening to stories and podcasts, so it's important to have them in the correct order for listening, i.e. chapters. Now the playlist doesn't show up on the itouch sorted correctly.
    1. Doesn't have Genre in Browser. 2. Doesn't auto sync. 3. Sort order is messed up between iTunes and iTouch. 4. Is it caused by 3.1.1 or iTunes 9.0? Does anyone know how to fix these issues? I don't have an old download of iTunes 8 to uninstall 9 and reinstall 8. iTouch 3.1.1 can't be uninstalled. Shadow

    shadow1953 wrote:
    1. Doesn't have Genre in Browser.
    iTunes 9 changed the browser to a column on the left side (by default), but you can go back to how it was on top, see the View/Column Browser menu. You can have multiple filters (Artist, Album, Composer, etc.) either as a column on the left, or across the top.
    shadow1953 wrote:
    2. Doesn't auto sync.
    You have to be doing something wrong since auto-sync does work. Make sure your iPod is in auto-sync mode -- if you change the sync mode, make sure you click the "Apply" button -- if you don't, it won't change. If you're not syncing your entire library, then make sure that you've selected the playlists you want loaded onto the Touch.
    shadow1953 wrote:
    3. Sort order is messed up between iTunes and iTouch.
    Are you referring to the sort order within a playlist, or the sort order of all your playlist names? I know that the playlist name sorting has changed (again) such that punctuaion comes first, then letters, then numbers. If you're referring to the sort order of the items within a playlist, then it may be a bug -- there are reports of problems with the sorting of podcasts within playlists, so maybe the same is true for books?
    shadow1953 wrote:
    4. Is it caused by 3.1.1 or iTunes 9.0? Does anyone know how to fix these issues?
    Not sure, could be either.
    shadow1953 wrote:
    I don't have an old download of iTunes 8 to uninstall 9 and reinstall 8. iTouch 3.1.1 can't be uninstalled.
    You can get down-rev versions of iTunes at sites like filehippo (there are others). Keep in mind though that your "iTunes Library.itl" file was changed with iTunes 9 and is not backward-compatible. You'll have to look for the old .itl file in your "Previous iTunes Libraries" folder (check the date of these .itl files). If you fid the .itl file from iTunes 8, just replace the current one and then uninstall iTunes as well as "Apple Mobile Device Services" and Quicktime, then install iTunes 8.
    You can go back to a prior OS version on your Touch if you have the native file (you would if you previously did a firmware update, it stays on your computer). If you updated to 3.0 then you can go back to it by holding the SHIFT key as you click the Restore button (use the OPT key on a Mac) and then select the 3.0 version. You can't go back to 2.x in this manner, but there is a different way to go back to 2.x if you ever want to (won't go into that here).

  • Default Sort Order for Library View

    It would be fantastic if there were a user defined preference for a default sort order in Library view. For example, some users may prefer to always view the images by File Name, or Rating, etc, without having to change the sort order for each individual folder they view via Lightroom.
    Thanks!

    Thanks for your suggestion Allan, but it doesn't work.
    I'm specifically referring to the defaults that Aperture 3 adopts when you use the "File, Import, Folders as Projects with the projects and albums setting.
    What I'm finding is regardless of the setting in the Library preferences, the default sort order for the project is Date and Manual for the album.
    Yet if I create a project manually the default sort order is as per the Library prefs. Strange.

  • Sort order notes iOS 6.0

    Since it is finally possible to sort my Notes with MacOS 10.8.2 I am desperately seeking for the same possibility on my iPhone and iPad (iOS 6.0). It does neither use the sort-order (alphabetically!!!) from my desktop Mac nor am I able to change the sort-order on my iPhone. This is really a pain! Any solution out there???
    Please Apple, if you dont want to allow the users to make their own choice of sort order, at least let them use and transfer the sort order they have on their Mac!!!
    By the way: same problem with photos! With iOS 6.0 the devices do NOT use (anymore) the sort order of my iPhoto-folders. WHY? Help!

    HI Friend,
    You must set the Cellular Data according (Settings>>General>>Cellular>>Cellular Data). Contact your carrier for further information.
    Turn on Cellular Data, Roaming and 3G as well, even your carrier doesn't have 3G available.
    Did you turn on Restrictions before?
    Hope it will be helpful

  • Predefined sort order of columns

    Hi,
    when my Discoverer users add columns to their tables they expect a certain sort order without having to press the 'sort button' or use the 'edit sheet dialog'.
    My only idea so far is to use a custom folder and ORDER BY in the SQL.
    Is there any better way to achieve a certain predefined sort order?
    Thanks
    Franziska

    While creating calculations and adding sorts on all of the columns will solve the immediate issue, every new worksheet will require the users to go through the same steps. It also sounds like your users actively create workbooks and sheets as needed, and these steps will have to be repeated.
    Something I thought of this morning may (or may not) work, and unfortunately I do not have time to test it today. But ... what if you created a view with an ORDER BY clause to sort the data as you wanted it sorted. In theory, the results should be returned ordered, without having to add any sorts at the Disco level. Since there is a fair amount of work in "retooling" a BA to use the views, it would be good to do a small proof of concept. Like I said, it might not work for a variety of reasons, and I am not sure what would happen if a user added a sort in Disco, or when two folders were joined.
    If it works, though, the sorting would be performed at the database level, with no additional sorting in Disco, and adding and removing columns from a report would have no impact on the sort.
    Then again, it might not work at all.

  • Sort order inconsistent behavior

    There seems to be inconsistent behaviour when defining a default sort order sequence.
    Everything works as expected when the display sequence and the order in which the columns are defined in the query are the same but as soon as the display sequence is changed the default sort order doesn't work for the second column in the order sequence.
    I have put up an example at [apex.com|http://apex.oracle.com/pls/otn/f?p=36885:1]
    In report EMP the display sequence and query sequence are the same and the default sort on "Job" and "Hiredate" is correct working. Even when the user sorts on "Manager".
    The sort order sequence then becomes "Manager", "Job" and "Hiredate". As also descripted in the following Sorting on multiple columns
    And exactly the behaviour we are looking for.
    Report EMP2 is a copy of EMP with the only difference the order in which the columns are displayed
    Now the default sort order doesn't work as expected. The report is first ordered on "Job" but then on "Employee" instate of "Hiredate" as is defined. Interestingly "Employee" is the second column in the query.
    It seems that instate of the query_column_id the column_display_sequence is used in the order by. At least for the second column in the defined sort order sequence.
    This may also explain the behaviour mentioned with [derived columns and sort sequence|http://forums.oracle.com/forums/thread.jspa?messageID=1006429&#1006429]
    The display sequence in report EMP2 is where the wizard came up with.
    Nicolette

    Stew
    At the report attributes you can define the sort sequence of a column. When you do that initialy the report is sorted as you defined it. So in my example that is first by "Job"and within "Job" by "Hiredate". When the user sort explicit on an other column this column is put before the columns you have defined.
    So when the user clicks on "Manager" the sort order becomes "Manager", "Job", "Hiredate". When the user then sort on "Employee" the sort order becomes "Employee", "Job" an "Hiredate".
    This works when the order in which the columns appear in your query are the same as the order in which they are displayed.
    BUT as soon as the display order changes the sort sequence doesn't work anymore. Even worse is that also the initial sort sequence doesn't work for the second column any more. (I haven't tested for three or more columns)
    In the example I have put on apex.com in the second report the sort sequence of the report attributes is the same as in the first report. But the initial sort order that is actually done is on "Job" and "Employee" instate of "Job" and "Hiredate". Where "Hiredate" is the second column in the display sequence. But "Employee" is the second column in the query.
    So to really make use of the sort sequence you have to keep your display sequence equal to the order in witch they appear in the query. This isn't really practical.
    Nicolette

  • Contact sorting broken in "Lists" print option?

    Wanted to print a simple contact list out of Address Book / er um... "Contacts".
    If i select "Mailing Lables", "Envelopes", or "Pocket Address Book"  everything seems to work as it should.
    However, if i select "Lists" the sort-order of list is completely messed-up.  I can't even make a guess at what criteria it might be trying to sort by, but it certianly isn't the names.
    Replicated the issue on my iMac running Mountain Lion as well.
    Anybody else seeing the same thing?
    ML bug or just something whacked w/ my contacts?

    Hi Peter,
    I can now rest assured that you feel my pain about being in so much pain, as its so painful being in this state of pain it must be a pain just reading this as it is sure is painful me writing it, pain pain pain.
    Yours,
    Pain
    PS
    pain |pān|
    noun
    1 physical suffering or discomfort caused by illness or injury: she's in great pain | those who suffer from back pain | chest pains.
    • mental suffering or distress: the pain of loss.
    • (also pain in the neck or vulgar slang pain in the *** ) [ in sing. ] informal an annoying or tedious person or thing: she's a pain.
    2 (pains) careful effort; great care or trouble: she took pains to see that everyone ate well | he is at pains to point out that he isn't like that.
    verb [ with obj. ]
    cause mental or physical pain to: it pains me to say this | her legs had been paining her.
    • [ no obj. ] (of a part of the body) hurt: sometimes my right hand would pain.
    PHRASES
    for one's pains informal as an unfairly bad return for efforts or trouble: he was sued for his pains.
    no pain, no gain suffering is necessary in order to achieve something.
    [originally used as a slogan in fitness classes.]
    on (or under ) pain of the penalty for disobedience or shortcoming being: all persons are commanded to keep silent on pain of imprisonment.
    ORIGIN Middle English (in the sense ‘suffering inflicted as punishment for an offense’): from Old French peine, from Latin poena ‘penalty,’ later ‘pain.’

  • Interactive sort order display

    How can I display the order in which the user has clicked the report columns using interactive sort feature?
    If I apply the interactive sort on two columns and user sorts first Column1 and then (holding Shift key) sorts Column2, then it is different sort order than when he clicks Column2 and then Column1.
    Unfortunately in both these situations, the column headers look the same. You can't tell which column used clicked first (which column is first in the sort order).
    I want to display the sort order before the tablix:
    - sort order: Column1, Column2
    or
    - sort order: Column2, Column1

    Hi jedrekc,
    According to your description, you have two columns with interactive sort in your report. Now you want to display the sequence of sorting so that you can see which column is sorted first. Right?
    In Reporting Service, we don’t have any variable or function to record some kind of event like you click on interactive sort icon. That means we can’t catch this click action so that it’s impossible to display the column names based on sorting order. So
    currently, your goal can’t be achieved.
    However, this kind of requirement is sensible and useful. I would recommend you to submit it as a feedback to the Microsoft Connect at this link https://connect.microsoft.com/SQLServer/Feedback.
    This connect site will serve as a connecting point between you and Microsoft, and ultimately the large community for you and Microsoft to interact with. Your feedback enables Microsoft to offer the best software and deliver superior services, meanwhile you
    can learn more about and contribute to the exciting projects on Microsoft Connect. 
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou (Pactera)

  • Wrong ordering of fotoalbums and lists in the explorer and some games.

    Since iOS 6 the fotoalbums and some lists in the browser and games are not anymore in the right order (e.g. a-b-c-d-m-n-o-p-e-f-g-r-s-t-u-....) What can I do?

    This is a totally absurd suggestion, except that it worked for me with my iPad.  Forget the network, then when asked for the password, enter a wrong one.  Try again and enter the correct password.  Good luck.

Maybe you are looking for