Jump to content


Ahmed36

Member Since 11 May 2006
Offline Last Active Jun 01 2007 11:22 AM
-----

Posts I've Made

In Topic: HOW TO EXPORT DATA FROM TABLE TO EXCEL FILE?

01 June 2007 - 11:16 AM

Hi All,

You need to create 3 global logics

1. to start xl 'startxl' type P

*****************syntax***********************
EXTERN($$SYSITEMS,$SHEET,$BOOK)
#X = DDE_EXECUTE('EXCEL','','[New(1)]')
#X = DDE_REQUEST('EXCEL','SYSTEM','SELECTION',$$SYSITEMS)
IF $$SYSITEMS = '' THEN
#X = SYSTEM-CRT('GUI WINDOWS ASYNC ' +
'C:\Program Files\Microsoft Office\Office\EXCEL.EXE')
$$SYSITEMS = '[Book1]Sheet1!R1C1'
ENDIF
$SHEET = $$SYSITEMS(1,INDEX($$SYSITEMS,'!') - 1)
$BOOK = $$SYSITEMS(1,INDEX($$SYSITEMS,']'))
UMSG('',2)

2. to create the headings in xl , 'headxl' type P

*****************syntax***********************
EXTERN(#END,$TITLE(),$SHEET,$CELL,#ROW)
FOR #X = 1 TO #END
$CELL = 'R1C' + CONV(#X)
#STATUS = DDE_POKE('EXCEL',$SHEET,$CELL,$TITLE(#X))
ENDFOR
#ROW = 2

3. to populate the xl sheet , popxl , type p

*****************syntax***********************
EXTERN(#END,$VARIABLE(),$SHEET,$CELL,#ROW)
FOR #X = 1 TO #END
$CELL = 'R' + CONV(#ROW) + 'C' + CONV(#X)
#STATUS = DDE_POKE('EXCEL',$SHEET,$CELL,$VARIABLE(#X))
ENDFOR
#ROW += 1

NOW YOU HAVE CR5EATED THESE GLOBAL LOGIC, HOW DO WE USE THEM

1. Define in logic 0

$TITLE(x,y)
$VARIABLE(x,y)

where x is the nomber of fields, and Y the length.

2. a. in the default logic of an LS

*start xl sheet (call first GL) -

startxl()

* define the headings as,

$TITLE(1) =
$TITLE(2) =
.
.
.
$TITLE(x) =
#END = x

* Then call the 2nd GL, to populate the xl

headxl()

b. within the LS

read a dummy file (last file read within the LS), place a logic in the BW as,

$VARIABLE(1) = fieldname
$VARIABLE(2) = fieldname
.
.
.
.
$VARIABLE(x) = fieldname
to avoid lossing the leading zeros on a field, use

$VARIABLE(x) = '=T("' + fieldname+ '")'

* write detail line to excel spreadsheet

popxl()


I hope the above assist you in your work.

In Topic: Glovia

15 May 2006 - 09:56 PM

Hi All,

Yes, i MEAN the ' ProIV Gui client?'

YOU MAY MOVE IT TO TH ERIGHT FOURM. THANKS