sort table - the calendar - InfoPath Dev
in

InfoPath Dev

sort table - the calendar

Last post 03-29-2013 09:34 AM by bsieloff. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 03-27-2013 08:00 PM

    sort table - the calendar

    Hi,

    First time using sort table and I'm not getting it to work correctly.  I'm sorting on a secondary data connection (sharepiont calendar) datasource name = Calendar

    I want to sort the titles by 'Start Time'

    So this is what I have

    SortTable /dsname=Calendar /row=/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Title compare=/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:EventDate

     my error code is:

    Required parameter unspecified: compare. Usage is:

    SortTable
    [/dsname=Data Source Name]
    /row=XPath to Table Row
    /compare=Relative XPath to Compare Field
    [/order=Sort Order (asc | desc)]
    [/type=Data Type (text | number)]

     give me a hint?

  • 03-28-2013 05:12 AM In reply to

    Re: sort table - the calendar

    Hi-

    It looks like you're missing a slash before compare?

    Also, this is incorrect:

     /row=/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Title

    You want the row parameter to point to the repeating node, so it would need to be

     /row=/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW

    In addition, /compare should be relative to the /row. So use:

    /compare=/d:EventDate

     Hope this helps!

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 03-28-2013 05:55 AM In reply to

    Re: sort table - the calendar

    Hi Ernesto,

    Thanks for taking a look.

    My command looks like:

    SortTable /dsname=Calendar /row=/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW /compare=/d:EventDate

    The command does run now but I dont see any change.  The table is exactly as it was.  I look at the result field but nothing is in there and the success checkbox is checked.  Where does the resulting sorted table get stored?

    Thanks again,

    -Bob

  • 03-28-2013 06:19 AM In reply to

    Re: sort table - the calendar

    I suspect the problem is the slash before d:EventDate, but you could drag the QdabraRules > Error, Success and Result nodes into the canvas to get more information about whether the command is working or not.
    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 03-28-2013 08:49 AM In reply to

    Re: sort table - the calendar

    That was it... the "/" before " /d:EventDate "

    Very cool

     Thanks

  • 03-28-2013 09:44 AM In reply to

    Re: sort table - the calendar

    ok... one more question for this thread.

     So I have the calendar items being sorted by date (Thanks again)

    I want to show only the most current 5 items on the form..

    I do this by adding an expression on the repeating table ( expresssion : position()>5 )

    If I order=DESC then I have calendar items from too far in the future being shown and filling up those 5 spots.. ie:

    May 30th Item 6

    May 29th Item 5

    May 29th Item 4

    May 29th Item 3

    May 28th Item 2

    May 28th Item 1

    May 27th Item -1

    May 27th Item -2

    May 26th Item -3

    May 25th Item -4

    so the top 5 here leaves out Item 1

    I then decided to put a formatting rule on the repeating table that says to hide any calendar item that is <= todays date and changed the order=ASC

    unfortunately the empty items (listed as negative in my example) are still counted towards the five items in my expression but just hidden and I only see one item, Item 1

    Any suggestions on how to get the top 5 dates starting with todays date and sorted decending?

    Thanks,

    -Bob

  • 03-28-2013 10:56 AM In reply to

    Re: sort table - the calendar

    It might be hard to achieve all of this on a single secondary data source. Have you thought of copying just the rows you need to another data source, to make things easier?

    http://www.infopathdev.com/files/folders/qrules/entry58854.aspx

    http://www.infopathdev.com/files/folders/qrules/entry58577.aspx

    You could use one of the two methods to copy just 5 items. The document explains decrementing all the way down to 0, but you could just iterate 5 times and be done, getting that data into a second data source.

    Be careful with position() and these type of things if you require browser compatibility. I've seen templates stop being browser compat because of hiding rows of a repeating table.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 03-29-2013 08:05 AM In reply to

    Re: sort table - the calendar

    I was also thinking of filtering with oData, but I have never filtered on date with oData and my command seems to be falling short.

    For starters I was going to fitler on a single date then expand it to greater than todays date

    my command is: https://my.company.com/_vti_bin/listdata.svc/Calendar?$filter=StartTime eq 2013-03-25T10:00:00

    do you think this could work?  If so, do you see the issue with my odata query?

    the xml:

     <m:properties>
            <d:ContentTypeID>0x010200C4E292BDA623AC46AAB10BD6AC79D86E</d:ContentTypeID>
            <d:Title>All Hands Meeting</d:Title>
            <d:Location>Room 1B</d:Location>
            <d:StartTime m:type="Edm.DateTime">2013-03-25T10:00:00</d:StartTime>
            <d:EndTime m:type="Edm.DateTime">2013-03-25T12:30:00</d:EndTime>
            <d:DONOTUSE m:null="true" />
            <d:AllDayEvent m:type="Edm.Boolean">false</d:AllDayEvent>
            <d:Recurrence m:type="Edm.Boolean">false</d:Recurrence>
            <d:Workspace m:type="Edm.Boolean">false</d:Workspace>
            <d:CategoryValue m:null="true" />
            <d:MonthDay>Monday, March 25</d:MonthDay>
            <d:Time>10:00 AM</d:Time>
            <d:Date_Time>Monday, March 25, 10:00 AM</d:Date_Time>
            <d:Summary>All hands meeting for Fermilab employees</d:Summary>
            <d:TITLE_SUMMARY>FemiLab All Hands Meeting - All hands meeting for employees</d:TITLE_SUMMARY>
            <d:StartDate m:type="Edm.DateTime">2013-03-25T10:00:00</d:StartDate>
            <d:Id m:type="Edm.Int32">1</d:Id>
            <d:ContentType>Event</d:ContentType>
            <d:Modified m:type="Edm.DateTime">2013-03-25T14:38:03</d:Modified>
            <d:Created m:type="Edm.DateTime">2013-03-22T14:28:17</d:Created>
            <d:CreatedById m:type="Edm.Int32">55</d:CreatedById>
            <d:ModifiedById m:type="Edm.Int32">53</d:ModifiedById>
            <d:Owshiddenversion m:type="Edm.Int32">5</d:Owshiddenversion>
            <d:Version>1.0</d:Version>
            <d:Path>/Lists/Calendar</d:Path>
          </m:properties>

  • 03-29-2013 09:34 AM In reply to

    Re: sort table - the calendar

    This poor cat.. I skinned it 100 different ways, but got my solution

    https://my.company.com/_vti_bin/listdata.svc/Calendar?$top=5&$orderby=StartTime desc

     

     

     

Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.