What about this code that create the DDL command based on alias passed as parameter and store it to clipboard?
LPARAMETERS tcTable
SELECT (tcTable)
lnFields = AFIELDS(laFlds)
SET TEXTMERGE on
SET TEXTMERGE TO memvar _cliptext
\\CREATE CURSOR <<tcTable>> (
FOR i=1 TO lnFields
IF i>1
\\,
ENDIF
\\<<laFlds[i,1]>> <<laFlds[i,2]>>
IF INLIST(laFlds[i,2],'N','F','C')
IF laFlds[i,4] <> 0
\\(<<laFlds[i,3]>>,<<laFlds[i,4]>>)
ELSE
\\(<<laFlds[i,3]>>)
ENDIF
ENDIF
IF laFlds[i,5] = .f.
\\ NOT NULL
ENDIF
NEXT
\\)
SET TEXTMERGE to
>Dorin, thanks for the reply.
>
>>>You can use CREATE CURSOR command in LOAD event to build a temporary cursor with the same structure until you issue SQLEXEC and refresh it with data.>>
>
>The problem is that I would like to define the cursor based on the structure of the back-end table(s), and not have to define the structure of each field in code.
>
>Regards,
>Alan