Trouble Creating Dialog, Say and Get from data

Trouble Creating Dialog, Say and Get from data

Postby cdmmaui » Wed Apr 28, 2010 1:02 am

Hello, I am having problems creating a data driven dialog with say and get. Can someone tell me what I am doing wrong? If someone could post sample code, it would be greatly appreciated. Thank you in advance for your assistance.

//---------------------------------------------------------------------------//
function RunRpt()

local oDlg, oIco , ;
nItems := 2 , ;
nStart1 := 0 , ;
nRow := 10 , ;
aTag1 := {} , ;
aSay1[10] , ;
aGet1[20] , ;
aVar1 := {} , ;
aVar2 := {} , ;
nFormat := 1 , ;
nPortrait := 2 , ;
nDialog := 0 , ;
cText := '' , ;
oText

MsgInfo( 'Updates Coming...', PA[04] )

// Determine Criteria Items... DO NOT FORGET PDF/XLS and Portrait/Landscape
SELECT reportd
GO TOP
SEEK report->serial
IF FOUND()
DO WHILE ! EOF() .AND. ( reportd->serial == report->serial )

IF reportd->criteria
nItems++

// Say....Tag...
AADD( aSay1, ALLTRIM( reportd->fieldname ) )

// Get 1...
AADD( aTag1, ALLTRIM( reportd->fieldname ) )
DO CASE
CASE ('[D]' $ reportd->fieldname)
AADD( aVar1, reportd->last01d )
CASE ('[L]' $ reportd->fieldname)
AADD( aVar1, reportd->last01l )
CASE ('[N]' $ reportd->fieldname)
AADD( aVar1, reportd->last01n )
OTHERWISE
AADD( aVar1, reportd->last01c )
ENDCASE

// Get 2...
IF reportd->crittype > 1
AADD( aTag1, ALLTRIM( reportd->fieldname ) )
DO CASE
CASE ('[D]' $ reportd->fieldname)
AADD( aVar1, reportd->last02d )
CASE ('[L]' $ reportd->fieldname)
AADD( aVar1, reportd->last02l )
CASE ('[N]' $ reportd->fieldname)
AADD( aVar1, reportd->last02n )
OTHERWISE
AADD( aVar1, reportd->last02c )
ENDCASE
ENDIF
ENDIF

IF LEN(aSay1)>=10
EXIT
ENDIF

SELECT reportd
SKIP
ENDDO
ENDIF
IF nItems>10
nItems := 10
ENDIF
nDialog := (nItems * 30) + 200

DEFINE ICON oIco RESOURCE 'WINFRT'

DEFINE DIALOG oDlg FROM 01,01 TO nDialog,500 TITLE ALLTRIM( report->reportname ) ICON oIco PIXEL

FOR nX=1 TO LEN( aSay1 )

SELECT reportd
GO TOP
SEEK report->serial
IF FOUND()
DO WHILE ! EOF() .AND. ( reportd->serial == report->serial ) .AND. ( nStart1 < nItems )
IF reportd->criteria

// Init...
nStart1++
aTag1[nStart1] := ALLTRIM( reportd->fieldname )
@nRow+2,010 SAY aSay[nStart1] VAR ALLTRIM( reportd->fieldname ) PIXEL

DO CASE
CASE ('[D]' $ reportd->fieldname)
aGet1[nStart1] := reportd->last01d
@nRow,099 GET aVar1[nStart1] VAR aGet1[nStart1] SIZE 35, 12 PICTURE "@D" OF oDlg PIXEL UPDATE
CASE ('[L]' $ reportd->fieldname)
aGet1[nStart1] := reportd->last01l
@nRow,099 CHECKBOX aVar1[nStart1] VAR aGet1[nStart1] OF oDlg PIXEL UPDATE
CASE ('[N]' $ reportd->fieldname)
aGet1[nStart1] := reportd->last01n
@nRow,099 GET aVar1[nStart1] VAR aGet1[nStart1] SIZE 50, 12 PICTURE "999999999.99" OF oDlg PIXEL UPDATE
OTHERWISE
aGet1[nStart1] := reportd->last01c
@nRow,099 GET aVar1[nStart1] VAR aGet1[nStart1] SIZE 50, 12 PICTURE "@!" OF oDlg PIXEL UPDATE
ENDCASE

IF reportd->crittype > 1
nStart1++
aTag1[nStart1] := ALLTRIM( reportd->fieldname )
@nRow+2,152 SAY 'to' PIXEL
DO CASE
CASE ('[D]' $ reportd->fieldname)
aGet1[nStart1] := reportd->last02d
@nRow,159 GET aVar1[nStart1] VAR aGet1[nStart1] SIZE 35, 12 PICTURE "@D" OF oDlg PIXEL UPDATE
CASE ('[L]' $ reportd->fieldname)
aGet1[nStart1] := reportd->last02l
@nRow,159 CHECKBOX aVar1[nStart1] VAR aGet1[nStart1] OF oDlg PIXEL UPDATE
CASE ('[N]' $ reportd->fieldname)
aGet1[nStart1] := reportd->last02n
@nRow,159 GET aVar1[nStart1] VAR aGet1[nStart1] SIZE 50, 12 PICTURE "999999999.99" OF oDlg PIXEL UPDATE
OTHERWISE
aGet1[nStart1] := reportd->last02c
@nRow,159 GET aVar1[nSTart1] VAR aGet1[nStart1] SIZE 50, 12 PICTURE "@!" OF oDlg PIXEL UPDATE
ENDCASE
ENDIF
nRow += 15
ENDIF
SELECT reportd
SKIP
ENDDO
ENDIF

// Format...
@nRow+12,010 SAY 'Report Format' PIXEL
@nRow,099 RADIO nFormat PROMPT "&XLS", "&PDF" OF oDlg PIXEL
nRow += 25

// Portrait or Landscape....
@nRow+12,010 SAY 'Orientation' PIXEL
@nRow,099 RADIO nPortrait PROMPT "&Portrait", "&Landscape" OF oDlg PIXEL WHEN (nFormat=2)
nRow += 35

@nRow, 069 BUTTON "&Print" SIZE 40, 12 ACTION MsgInfo( 'Create Report' ) DEFAULT PIXEL
@nRow, 124 BUTTON "&Cancel" SIZE 40, 12 ACTION oDlg:End() PIXEL

ACTIVATE DIALOG oDlg CENTERED

RETURN (.T.)
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Trouble Creating Dialog, Say and Get from data

Postby James Bott » Wed Apr 28, 2010 2:49 pm

Define "problems." Specifically, what problem are you having?

It would also help if you would use the code designation when posting code so it retains the indenting. A few comments would help too.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 64 guests