Hi Geert,

You're right !

         for $sessionId in $sessionIds
         return

            for $sessionLogs in $tplogs[sessionId=$sessionId]
            let $dateCreated := $sessionLogs/dateCreated
            order by $dateCreated
            return $dateCreated


I modified the query and it now works.

Thanks !

- Danny

On Mon, May 7, 2012 at 10:32 AM, Geert Josten <[email protected]> wrote:

> Hi Danny,
>
>
>
> Sounds like your SessionId isn’t unique within $searchResults. Either get
> only one of them, or rearrange your FLWOR to compensate for that..
>
>
>
> Kind regards,
>
> Geert
>
>
>
> *Van:* [email protected] [mailto:
> [email protected]] *Namens *Danny Sinang
> *Verzonden:* maandag 7 mei 2012 16:20
> *Aan:* general
> *Onderwerp:* [MarkLogic Dev General] Invalid 'order by' value
>
>
>
> Hi,
>
>
>
> I'm trying to return an ordered list of log entries but am getting an
> "Invalid order by value'.
>
>
>
> Below are the error details.
>
>
>
> Looking at the dateCreated values, they all look normal to me.
>
>
>
> For
> example, fn:doc("/trustedPartnerLogs/2608.xml")/trustedPartnerLog/dateCreated
> yields :
>
>
>
> 2012-05-04T10:16:17.642084-05:00
>
>
>
> Any idea what i'm doing wrong ?
>
>
>
> Regards,
> Danny
>
>
>
>
> ==========================================================================================
>
> *query evaluated in xplana-dev at file::Modules/Xplana2/xqy as 1.0-ml (cq
> v4.2-6)*
>
> *[1.0-ml] XDMP-ORDERBYVAL: order by $sessionLogs/dateCreated ascending --
> Invalid 'order by' value
> (fn:doc("/trustedPartnerLogs/2608.xml")/trustedPartnerLog/dateCreated,
> fn:doc("/trustedPartnerLogs/2596.xml")/trustedPartnerLog/dateCreated,
> fn:doc("/trustedPartnerLogs/2598.xml")/trustedPartnerLog/dateCreated, ...)
> *
>
> *Stack trace:*
>
> at 8
>
> 6:               for $sessionId in $sessionIds
> 7:               let $sessionLogs := $searchResults[sessionId=$sessionId]
>
>
>
> 8: *              order by $sessionLogs/dateCreated*
> 9:               return $sessionLogs/dateCreated
> 10:
>
>
> xdmp:eval("let $searchResults :=
> /trustedPartnerLog[customerId=&quot;DUMMY&...", (), <options
> xmlns="xdmp:eval"><database>7662317996035917662</database><root>Modules/Xplana2/xq...</options>)
>
> $searchResults :=
> (fn:doc("/trustedPartnerLogs/2608.xml")/trustedPartnerLog,
> fn:doc("/trustedPartnerLogs/2576.xml")/trustedPartnerLog,
> fn:doc("/trustedPartnerLogs/2580.xml")/trustedPartnerLog, ...)
> $sessionIds := (xs:untypedAtomic("1000043_SESSION4"),
> xs:untypedAtomic("1000043_SESSION2"), xs:untypedAtomic("1000043_SESSION3"),
> ...)
> $groupBy := "bookId"
>
> in /eval.xqy at 115
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to