Here is some example code:

xquery version "3.0";

declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";;

declare option output:method "text";
declare option output:media-type "text/csv";

let $nl := "
"
let $header := "Column 1, Column 2, Column3"
let $text := string-join(($header, for $usage in $usages//usage
                    order by $usage ascending
                    return local:usage-csv($usage, $rel-ver-path,$release, 
$version, $model)
                ), $nl)

(: Use either :)
return $text

(: or
    return xmldb:store($collection-path, 'report.csv', $text)
:)

(: to kick off a scheduled task :)
let $trigger-path := $config:app-root ||'/modules/scheduler/mytask.xq'
let $scheduled-name := 'AAA'
let $scheduled-parameters :=
    element { 'parameters' } {
    }                                    
let $query := system:as-user('admin', 'xyzzy', 
            scheduler:schedule-xquery-periodic-job($trigger-path,1000, 
$scheduled-name, $scheduled-parameters, 1000, 0))
return
<results>
   <message>File {$uuid} has been stored.</message>
</results>
 

or

scheduler:schedule-xquery-cron-job($trigger-path, "0 0 13 * * 
?",$scheduled-name, $scheduled-parameters)

http://exist-db.org/exist/apps/doc/scheduler.xml
 
 



Sent from my iPad

> On May 29, 2014, at 1:27 PM, Loren Cahlander <[email protected]> 
> wrote:
> 
> You can generate a csv or create an open doc spreadsheet 
> http://www.opendocumentformat.org/features/
> 
> I do not know of any module to generate an excel spreadsheet within eXist.  
> You can read a spreadsheet using the content extraction function module.
> 
> Here is a resource for outputting a text document: 
> http://en.wikibooks.org/wiki/XQuery/eXist_Crib_sheet#output_plain_text_document_with_no_doctype
> 
> 
> Sent from my iPad
> 
>> On May 29, 2014, at 12:38 PM, Inderjeet Singh Narang 
>> <[email protected]> wrote:
>> 
>> Hi,
>> I am using eXist-db and easydita.
>> 
>> I want to fetch records from eXist-db and then generate excel report through 
>> scheduler at a specified time say 1:00 PM everyday. At 1:00 PM scheduler 
>> will run and will generate excel report by fetching data from eXist-db.
>> 
>> Thanks
>> Inderjeet
>> From: Loren Cahlander [[email protected]]
>> Sent: Thursday, May 29, 2014 8:53 PM
>> To: Murray, Gregory
>> Cc: Inderjeet Singh Narang; [email protected]
>> Subject: Re: [xquery-talk] generate and schedule report
>> 
>> What system are you using?  I am thinking eXist-db due to the scheduler 
>> reference.
>> 
>> Sent from my iPad
>> 
>> On May 29, 2014, at 8:41 AM, "Murray, Gregory" <[email protected]> 
>> wrote:
>> 
>>> Please post a short example of what the input looks like and what of the 
>>> format you want to output. Alternatively, it sounds like you are converting 
>>> one form of XML to another, in which case XSLT might be a simpler option 
>>> than XQuery.
>>> 
>>> 
>>>> On May 29, 2014, at 6:07 AM, Inderjeet Singh Narang wrote:
>>>> 
>>>> I am new to xquery. I want to generate excel report through scheduler. 
>>>> Please help me to sort out the issue.
>>>> Your help will be greately appreciated.
>>>>  
>>>> Thanks & Regards
>>>> Inderjeet
>>>>  
>>>> _______________________________________________
>>>> [email protected]
>>>> http://x-query.com/mailman/listinfo/talk
>>> _______________________________________________
>>> [email protected]
>>> http://x-query.com/mailman/listinfo/talk
>> 
>> 
>> 
>> 
>> 
>> 
>> DISCLAIMER
>> 
>> The information transmitted, including any attachments, is intended only for 
>> the person or entity to which it is addressed and may contain confidential 
>> and/or privileged material. Any form of reproduction, dissemination, 
>> copying, disclosure, modification, distribution and / or publication of this 
>> message without the prior written consent of the author of this e-mail is 
>> strictly prohibited. If you receive this email by mistake, please advise the 
>> sender and delete it immediately. Email transmission cannot be guaranteed to 
>> be secure, or error free as information could be intercepted, corrupted, 
>> lost or destroyed as a result of the transmission process. Views or opinions 
>> presented in this email are solely those of the author and do not 
>> necessarily represent those of the company. Please be aware that the Company 
>> monitors email communications through our networks for regulatory compliance 
>> purposes. NIIT Technologies Limited and its related entities consider the 
>> privacy of its clients to be of utmost importance and works to protect it. 
>> The Privacy Policy of the Company can be accessed from our website 
>> “www.niit-tech.com. (s).
_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk

Reply via email to