Here is some code I used to create a CSV with custom headers and other info.
In this case, Two tables where created and populated.
This code does the rest.  

Dennis McGRath

SET VAR vFile = (CVAL('SCRATCH') + '\WeekSum.CSV')

LABEL TryAgain
SET EOF OFF
SET NULL ' '
OUT &vFile
IF ErrVar <> 0 THEN
  SET EOF ON
  SET NULL '-0-'
  SET VAR vTmp = ('Failed opening' & .vFile)
  PAUSE 1 USING .vTmp
  DIALOG 'Try again?' vResp vKey YES
  IF vResp = 'yes' THEN
    GOTO TryAgain
  ELSE
    GOTO Done
  ENDIF
ENDIF

WRI '"', .vUserFullName, 'weekly time summary for', .vBegDate, 'to',+
  .vEndDate, '"'
WRI '" "'

WRI +
  '"Week 
of","Hours","OverTime","Vacation","Holiday","Personal","","Punch","Over"'
SET QUOTES=""""
UNLOAD DATA FOR TempEmpWeek AS ASCII
WRI """ """
UNLOAD DATA FOR TempEmpTotals AS ASCII
SET QUOTES=''''
IF vVacation > 0 THEN
  WRI '" "'
  SET VAR vTmp = ('" "," "," ",' + CTXT(.vVacation) + ',"Vacation Days"')
  WRI .vTmp
ENDIF
OUT SCR
SET NULL '-0-'
SET EOF ON

IF (CVAL('Version System')) = 'DOS' THEN
  ZIP LAUNCH &vfile
ELSE
  LAUNCH &vFile
ENDIF

LABEL Done




-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of frank van der 
Zwaag
Sent: Friday, June 18, 2010 3:09 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: Gateway Export in EEP

Thanks Tony, and all others,

I did have an export function whereby I wrote every line to an cvs 
output file using multiple cursors.  Problem was that my nice client (NZ 
Police) wanted some of the headers changed and fields changed and all 
sheets in one workbook and so on. So, I thought a quick fix would be to 
generate an rgw file, specify all field formats, create a view and 
generate an xls.

I know for sure that I saw Razzak do something like that....  Razzak, 
when you have a moment and you're of the skie field, am I right?

I checked the syntax and, as per Toy's response, thought that I could 
use that gateway export trick in an eep.

My question (finally they all said) is: How else would you incorporate 
that syntax in an application. Run it as an rmd file; that would be 
problematic for me as all my application code is contained within 
forms.  I am not supplying anything else.

Thanks for all help.  This listserver rocks; just like r:base


On 17/06/2010 11:45 p.m., A.G. IJntema wrote:
>
> Hi Frank,
>
> Your name looks Dutch maybe even Friesian.
>
> You can create an RGW at export by taking the first row at Select 
> Format (gateway, export). The first option is Use Export wizard
>
> The you are able to create an export wizard and it can be saved as RGW.
>
> It took me also a while before I noticed this option
>
> The procedure can look like this
>
> *GATEWAY* *EXPORT* XLS *<filename>* *+*
> *SELECT* *+*
> <field1>, +
>
> <field2>, +
>
>    ...
>
> <fieldn> +
>
> *FROM* <viewname> *+*
> *WHERE* <whereclause> *+*
> *OPTION* *|*SHOW_PROGRESS *ON* *+*
> *|**ACTION* OPENVIEW *+*
> *|**SPECIFICATION_FILE_NAME* <filename_rgw>*.*rgw
>
> However you cannot use this procedure in an EEP, because an EEP  does 
> not allow to make use of GATEWAY.
>
> Hope this helps
>
> Tony IJntema
>
> The Netherlands
>
> *From:* [email protected] [mailto:[email protected]] *On Behalf Of 
> *frank van der Zwaag
> *Sent:* donderdag 17 juni 2010 13:22
> *To:* RBASE-L Mailing List
> *Subject:* [RBASE-L] - Gateway Export in EEP
>
> Hi All,
>
> does anybody have a sample EEP script that I can use to export the 
> data from a view into an xls spreadsheet using a pre-defined export 
> format (rgw) file.
>
> Thanks
>

-- 


Reply via email to