From: Stephen Quinn on
Kevin

> If that is in the help file I missed it.
More than likely it's in the COMIX/SIXDRIVER manuals for Clipper.

Parts of VO still use the 10 character naming conventions/limitations of
Clipper
- you just found one<g>

Not advisable to use long filenames (10+ characters) with VO anyway as you
never know when the problem will occur.

CYA
Steve



From: richard.townsendrose on
Kevin

i have a three stage structure based on reportpro table list
METHOD Init() CLASS DataFiles

SUPER:Init()

SELF:aDataFiles:=ArrayNew(No_of_Files)

SELF:aDataFiles[FileDOCAC]:= {GetDefault()+"DOCAC.dbf" ,"Work Package
Values" , "AXDBFCDX" , FALSE}
SELF:aDataFiles[FileDOCAD]:= {GetDefault()+"DOCAD.dbf" ,"Group
Definitions" , "AXDBFCDX" , FALSE}
etc etc

this is passed to the reportpro designer allowing users to add table
to and configure reports ...

THEN - table structures
METHOD Init() CLASS DataStruct
LOCAL aTemp:={} AS ARRAY
LOCAL n AS WORD
LOCAL lICUnique AS LOGIC

// UPREV Major release when changing Data Structure
_TDOC_MAJORRELEASE

// Get Parameters affecting Indexes // Set at start of DoCheck3()
lICUnique:=SysObject():GetParam(ICNoUnique)

// Create Reports Files array
SUPER:Init()

// Create Structure Array
SELF:aDataStruct:=ArrayNew(Len(aDataFiles),5) // sFilePath&Name,
sTitle, aDBFStructure, aCDXStructure, lHasFPT, lHasPatch

// Collect data from aDataFiles
FOR n = 1 TO Len(aDataFiles)
aTemp:=aDataFiles[n]
aDataStruct[n,FilePathName]:=aTemp[FilePathName]
aDataStruct[n,Title]:=aTemp[Title]
NEXT

// Complete with structure details // overhauled 110708
// DOCAC ***********************************
aDataStruct[FileDOCAC,DBFStructure]:= { ;
{ 'JOBNO' , 'C', 8, 0}, ;
{ 'GROUP' , 'C', 8, 0}, ; // blank means the job
budget
{ 'VALUE' , 'N', 9, 0}, ;
{ 'DCN' , 'C', 5, 0}, ;
{ 'Transfer' , 'C', 8, 0}, ; // rgtr
{ 'COMMENT' , 'C', 80, 0}, ;
{ 'DOCNO' , 'C', 8, 0}, ; // rgtr 27jan08
{ 'RECORDDATE' , 'D', 8, 0}, ;
{ 'RECORDTYPE' , 'C', 1, 0}, ; // Job: N -> Setup
[Client Instruction], WP: S -> SetUp [Insruction], T,U -> Transfers,
P -> Certify Payment Q-> Retention Held, R -> Release Retention
{ 'STARTDATE' , 'D', 8, 0}, ;
{ 'ENDDATE' , 'D', 8, 0}, ;
{ 'RISK' , 'C', 1, 0}, ; // P only
{ 'DOCREF' , 'C', 8, 0} } // for linking docs
together // rgtr 27jan08

aDataStruct[FileDOCAC,CDXStructure]:= { ;
{'DOCAC1','JobNo + Group + DToS(RecordDate)',{|| _FIELD->JobNo +
_FIELD->Group + DToS(_FIELD->RecordDate)}, NIL, NIL} , ;
{'DOCAC2','JobNo + Group + DocRef', {|| _FIELD->JobNo +
_FIELD->Group + _FIELD->DocRef}, NIL, NIL} , ;
{'DOCAC3','JobNo + Transfer', {|| _FIELD->JobNo +
_FIELD->Transfer}, NIL, NIL} }

aDataStruct[FileDOCAC,HasFPT]:=FALSE

etc etc

NEXT to create dbf or modify structure

METHOD CreateDBF(wFileNo, sPatchName) CLASS CheckW
// Create Missing DBF
LOCAL lSuccess:=FALSE AS LOGIC
LOCAL hConnection:=0 AS DWORD
LOCAL cFieldSpec AS STRING
LOCAL phTable AS DWORD
LOCAL ulRetCode AS DWORD

IF wFileNo == FileDOCNS .OR. wFileNo == FileDOCDT
cFieldSpec:=SELF:GetFields(wFileNo)

IF Empty(sPatchName)
ulRetCode:=AdsCreateTable(hConnection,
PSZ(SELF:aFileStru[wFileNo,FilePathName]), NULL_PSZ,
ADS_CDX, ADS_OEM, ADS_PROPRIETARY_LOCKING,
ADS_IGNORERIGHTS, ADS_DEFAULT, PSZ(cFieldSpec), @phTable)
// AdsCreateTable(hConnection AS DWORD, pucName AS
PSZ, pucAlias AS PSZ, usTableType AS WORD,
usCharType AS WORD, usLockType AS WORD, usCheckRights AS WORD,
usMemoSize AS WORD, pucFields AS PSZ, phTable REF DWORD)
//
info /
* or ADS_ANSI*/ /*Per
Shell:Init()*/ //
"EMPID,Numeric,5,0; DEPT, .....
ELSE
ulRetCode:=AdsCreateTable(hConnection,
PSZ(sPatchName), NULL_PSZ,
ADS_CDX, ADS_OEM, ADS_PROPRIETARY_LOCKING,
ADS_IGNORERIGHTS, ADS_DEFAULT, PSZ(cFieldSpec), @phTable)
ENDIF
AdsCloseTable(phTable)
IF ulRetCode == AE_SUCCESS
lSuccess:=TRUE
ENDIF

ELSE
IF Empty(sPatchName)

lSuccess:=DBCREATE(SELF:aFileStru[wFileNo,FilePathName],SELF:aFileStru[wFileNo,DBFStructure],,,"DOCQQ")
ELSE
lSuccess:=DBCREATE(sPatchName,
SELF:aFileStru[wFileNo,DBFStructure])
ENDIF
ENDIF

IF wFileNo == FileDOCNM .AND. lSuccess .AND. Empty(sPatchName)
lSuccess:=SELF:AddDefaultName()
ENDIF

RETURN lSuccess

NEXT to build/ rebuild cdx
METHOD CreateCDX(wFileNo, oServer) CLASS CheckW
// Create cdx requested
LOCAL lHandedServer:=TRUE AS LOGIC
LOCAL lSuccess:=FALSE AS LOGIC
LOCAL aCDXStru AS ARRAY
LOCAL wAtIndex AS DWORD
LOCAL cFilePathName:='' AS STRING
LOCAL oSelf AS CheckW
LOCAL dwOldPos AS DWORD
LOCAL rOldRange AS Range

IF ! SELF:oDCItemBar == NULL_OBJECT
oSelf:=SELF
dwOldPos:=SELF:oDCItemBar:OldPosition
rOldRange:=SELF:oDCItemBar:Range
ENDIF

cFilepathName:=SubStr(SELF:aFileStru[wFileNo,FilePathName],
1,Len(SELF:aFileStru[wFileNo,FilePathName])-4) + '.cdx'
IF oServer == NULL_OBJECT
oServer:=DBServer{SELF:aFileStru[wFileNo,FilePathName],FALSE,FALSE}
lHandedServer:=FALSE
ENDIF
IF ! oServer:Used // failed to get / open
table
oServer:=NULL_OBJECT
lSuccess:=FALSE
RETURN lSuccess
ENDIF

aCDXStru:=SELF:aFileStru[wFileNo,CDXStructure]

FOR wAtIndex:=1 TO ALen(aCDXStru)
// set progress bar
IF ! SELF:oDCItemBar == NULL_OBJECT
SELF:oDCInfoText:TextValue:=LoadResString('Replacing
Index',IDK_REPLACINGINDEX,nPLH) + ' ' + NTrim(wAtIndex) + ' / ' +
NTrim(ALen(aCDXStru)) + ' - ' + NTrim(oServer:RecCount)
SELF:oDCItemBar:Range:=Range{0, 100}
SELF:oDCItemBar:Position:=0
ENDIF

IF ! SELF:oDCItemBar == NULL_OBJECT
IF ! Empty(aCDXStru[wAtIndex,5])
lSuccess:=oServer:SetOrderCondition(aCDXStru[wAtIndex,4],
aCDXStru[wAtIndex,5], , , {||oSelf:CreateCDXProg()})
ELSE
lSuccess:=oServer:SetOrderCondition(NIL, NIL, , , {||
oSelf:CreateCDXProg()})
ENDIF
ELSE
IF ! Empty(aCDXStru[wAtIndex,5])
lSuccess:=oServer:SetOrderCondition(aCDXStru[wAtIndex,4],
aCDXStru[wAtIndex,5])
ELSE
lSuccess:=oServer:SetOrderCondition(NIL, NIL)
ENDIF
ENDIF

IF lSuccess // order condition set ok
lSuccess:=oServer:CreateOrder(aCDXStru[wAtIndex,1], cFilePathName,
aCDXStru[wAtIndex,2], aCDXStru[wAtIndex,3])
ENDIF
IF ! lSuccess // failed to set order condition OR create order
EXIT
ENDIF
NEXT

// set progress bar back
IF ! SELF:oDCItemBar == NULL_OBJECT
SELF:oDCItemBar:Range:=rOldRange
SELF:oDCItemBar:Position:=dwOldPos
SELF:oDCInfoText:Value:=''
ENDIF

IF ! lHandedServer
oServer:Close()
oServer:=NULL_OBJECT
ENDIF

RETURN lSuccess

note driving a progress bar etc

richard



From: Kevin on
Richard,

Thanks for your reply and code. At an initial glance it looks complex. I
don't have time to look at it now but will later.

Kevin

"richard.townsendrose" <richard.townsendrose(a)googlemail.com> wrote in
message
news:af0ba530-c4fc-4d0d-82f0-ebaddf7ade61(a)u22g2000yqf.googlegroups.com:

> Kevin
>
> i have a three stage structure based on reportpro table list
> METHOD Init() CLASS DataFiles
>
> SUPER:Init()
>
> SELF:aDataFiles:=ArrayNew(No_of_Files)
>
> SELF:aDataFiles[FileDOCAC]:= {GetDefault()+"DOCAC.dbf" ,"Work Package
> Values" , "AXDBFCDX" , FALSE}
> SELF:aDataFiles[FileDOCAD]:= {GetDefault()+"DOCAD.dbf" ,"Group
> Definitions" , "AXDBFCDX" , FALSE}
> etc etc
>
> this is passed to the reportpro designer allowing users to add table
> to and configure reports ...
>
> THEN - table structures
> METHOD Init() CLASS DataStruct
> LOCAL aTemp:={} AS ARRAY
> LOCAL n AS WORD
> LOCAL lICUnique AS LOGIC
>
> // UPREV Major release when changing Data Structure
> _TDOC_MAJORRELEASE
>
> // Get Parameters affecting Indexes // Set at start of DoCheck3()
> lICUnique:=SysObject():GetParam(ICNoUnique)
>
> // Create Reports Files array
> SUPER:Init()
>
> // Create Structure Array
> SELF:aDataStruct:=ArrayNew(Len(aDataFiles),5) // sFilePath&Name,
> sTitle, aDBFStructure, aCDXStructure, lHasFPT, lHasPatch
>
> // Collect data from aDataFiles
> FOR n = 1 TO Len(aDataFiles)
> aTemp:=aDataFiles[n]
> aDataStruct[n,FilePathName]:=aTemp[FilePathName]
> aDataStruct[n,Title]:=aTemp[Title]
> NEXT
>
> // Complete with structure details // overhauled 110708
> // DOCAC ***********************************
> aDataStruct[FileDOCAC,DBFStructure]:= { ;
> { 'JOBNO' , 'C', 8, 0}, ;
> { 'GROUP' , 'C', 8, 0}, ; // blank means the job
> budget
> { 'VALUE' , 'N', 9, 0}, ;
> { 'DCN' , 'C', 5, 0}, ;
> { 'Transfer' , 'C', 8, 0}, ; // rgtr
> { 'COMMENT' , 'C', 80, 0}, ;
> { 'DOCNO' , 'C', 8, 0}, ; // rgtr 27jan08
> { 'RECORDDATE' , 'D', 8, 0}, ;
> { 'RECORDTYPE' , 'C', 1, 0}, ; // Job: N -> Setup
> [Client Instruction], WP: S -> SetUp [Insruction], T,U -> Transfers,
> P -> Certify Payment Q-> Retention Held, R -> Release Retention
> { 'STARTDATE' , 'D', 8, 0}, ;
> { 'ENDDATE' , 'D', 8, 0}, ;
> { 'RISK' , 'C', 1, 0}, ; // P only
> { 'DOCREF' , 'C', 8, 0} } // for linking docs
> together // rgtr 27jan08
>
> aDataStruct[FileDOCAC,CDXStructure]:= { ;
> {'DOCAC1','JobNo + Group + DToS(RecordDate)',{|| _FIELD->JobNo +
> _FIELD->Group + DToS(_FIELD->RecordDate)}, NIL, NIL} , ;
> {'DOCAC2','JobNo + Group + DocRef', {|| _FIELD->JobNo +
> _FIELD->Group + _FIELD->DocRef}, NIL, NIL} , ;
> {'DOCAC3','JobNo + Transfer', {|| _FIELD->JobNo +
> _FIELD->Transfer}, NIL, NIL} }
>
> aDataStruct[FileDOCAC,HasFPT]:=FALSE
>
> etc etc
>
> NEXT to create dbf or modify structure
>
> METHOD CreateDBF(wFileNo, sPatchName) CLASS CheckW
> // Create Missing DBF
> LOCAL lSuccess:=FALSE AS LOGIC
> LOCAL hConnection:=0 AS DWORD
> LOCAL cFieldSpec AS STRING
> LOCAL phTable AS DWORD
> LOCAL ulRetCode AS DWORD
>
> IF wFileNo == FileDOCNS .OR. wFileNo == FileDOCDT
> cFieldSpec:=SELF:GetFields(wFileNo)
>
> IF Empty(sPatchName)
> ulRetCode:=AdsCreateTable(hConnection,
> PSZ(SELF:aFileStru[wFileNo,FilePathName]), NULL_PSZ,
> ADS_CDX, ADS_OEM, ADS_PROPRIETARY_LOCKING,
> ADS_IGNORERIGHTS, ADS_DEFAULT, PSZ(cFieldSpec), @phTable)
> // AdsCreateTable(hConnection AS DWORD, pucName AS
> PSZ, pucAlias AS PSZ, usTableType AS WORD,
> usCharType AS WORD, usLockType AS WORD, usCheckRights AS WORD,
> usMemoSize AS WORD, pucFields AS PSZ, phTable REF DWORD)
> //
> info /
> * or ADS_ANSI*/ /*Per
> Shell:Init()*/ //
> "EMPID,Numeric,5,0; DEPT, .....
> ELSE
> ulRetCode:=AdsCreateTable(hConnection,
> PSZ(sPatchName), NULL_PSZ,
> ADS_CDX, ADS_OEM, ADS_PROPRIETARY_LOCKING,
> ADS_IGNORERIGHTS, ADS_DEFAULT, PSZ(cFieldSpec), @phTable)
> ENDIF
> AdsCloseTable(phTable)
> IF ulRetCode == AE_SUCCESS
> lSuccess:=TRUE
> ENDIF
>
> ELSE
> IF Empty(sPatchName)
>
> lSuccess:=DBCREATE(SELF:aFileStru[wFileNo,FilePathName],SELF:aFileStru[wFileNo,DBFStructure],,,"DOCQQ")
> ELSE
> lSuccess:=DBCREATE(sPatchName,
> SELF:aFileStru[wFileNo,DBFStructure])
> ENDIF
> ENDIF
>
> IF wFileNo == FileDOCNM .AND. lSuccess .AND. Empty(sPatchName)
> lSuccess:=SELF:AddDefaultName()
> ENDIF
>
> RETURN lSuccess
>
> NEXT to build/ rebuild cdx
> METHOD CreateCDX(wFileNo, oServer) CLASS CheckW
> // Create cdx requested
> LOCAL lHandedServer:=TRUE AS LOGIC
> LOCAL lSuccess:=FALSE AS LOGIC
> LOCAL aCDXStru AS ARRAY
> LOCAL wAtIndex AS DWORD
> LOCAL cFilePathName:='' AS STRING
> LOCAL oSelf AS CheckW
> LOCAL dwOldPos AS DWORD
> LOCAL rOldRange AS Range
>
> IF ! SELF:oDCItemBar == NULL_OBJECT
> oSelf:=SELF
> dwOldPos:=SELF:oDCItemBar:OldPosition
> rOldRange:=SELF:oDCItemBar:Range
> ENDIF
>
> cFilepathName:=SubStr(SELF:aFileStru[wFileNo,FilePathName],
> 1,Len(SELF:aFileStru[wFileNo,FilePathName])-4) + '.cdx'
> IF oServer == NULL_OBJECT
> oServer:=DBServer{SELF:aFileStru[wFileNo,FilePathName],FALSE,FALSE}
> lHandedServer:=FALSE
> ENDIF
> IF ! oServer:Used // failed to get / open
> table
> oServer:=NULL_OBJECT
> lSuccess:=FALSE
> RETURN lSuccess
> ENDIF
>
> aCDXStru:=SELF:aFileStru[wFileNo,CDXStructure]
>
> FOR wAtIndex:=1 TO ALen(aCDXStru)
> // set progress bar
> IF ! SELF:oDCItemBar == NULL_OBJECT
> SELF:oDCInfoText:TextValue:=LoadResString('Replacing
> Index',IDK_REPLACINGINDEX,nPLH) + ' ' + NTrim(wAtIndex) + ' / ' +
> NTrim(ALen(aCDXStru)) + ' - ' + NTrim(oServer:RecCount)
> SELF:oDCItemBar:Range:=Range{0, 100}
> SELF:oDCItemBar:Position:=0
> ENDIF
>
> IF ! SELF:oDCItemBar == NULL_OBJECT
> IF ! Empty(aCDXStru[wAtIndex,5])
> lSuccess:=oServer:SetOrderCondition(aCDXStru[wAtIndex,4],
> aCDXStru[wAtIndex,5], , , {||oSelf:CreateCDXProg()})
> ELSE
> lSuccess:=oServer:SetOrderCondition(NIL, NIL, , , {||
> oSelf:CreateCDXProg()})
> ENDIF
> ELSE
> IF ! Empty(aCDXStru[wAtIndex,5])
> lSuccess:=oServer:SetOrderCondition(aCDXStru[wAtIndex,4],
> aCDXStru[wAtIndex,5])
> ELSE
> lSuccess:=oServer:SetOrderCondition(NIL, NIL)
> ENDIF
> ENDIF
>
> IF lSuccess // order condition set ok
> lSuccess:=oServer:CreateOrder(aCDXStru[wAtIndex,1], cFilePathName,
> aCDXStru[wAtIndex,2], aCDXStru[wAtIndex,3])
> ENDIF
> IF ! lSuccess // failed to set order condition OR create order
> EXIT
> ENDIF
> NEXT
>
> // set progress bar back
> IF ! SELF:oDCItemBar == NULL_OBJECT
> SELF:oDCItemBar:Range:=rOldRange
> SELF:oDCItemBar:Position:=dwOldPos
> SELF:oDCInfoText:Value:=''
> ENDIF
>
> IF ! lHandedServer
> oServer:Close()
> oServer:=NULL_OBJECT
> ENDIF
>
> RETURN lSuccess
>
> note driving a progress bar etc
>
> richard

First  |  Prev  | 
Pages: 1 2
Prev: WebService
Next: Importing and Exporting to Excel