FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Trouble Creating Dialog, Say and Get from data
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Trouble Creating Dialog, Say and Get from data
Posted: Wed Apr 28, 2010 01: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-&gt;fieldname )
        @nRow+2,010 SAY aSay[nStart1] VAR ALLTRIM( reportd-&gt;fieldname ) PIXEL

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

        IF reportd-&gt;crittype &gt; 1
           nStart1++
           aTag1[nStart1] := ALLTRIM( reportd-&gt;fieldname )
           @nRow+2,152 SAY 'to' PIXEL
           DO CASE
              CASE ('[D]' $ reportd-&gt;fieldname)
                   aGet1[nStart1] := reportd-&gt;last02d
                   @nRow,159 GET aVar1[nStart1] VAR aGet1[nStart1] SIZE 35, 12    PICTURE &quot;@D&quot;            OF oDlg PIXEL UPDATE
              CASE ('[L]' $ reportd-&gt;fieldname)
                   aGet1[nStart1] := reportd-&gt;last02l
                   @nRow,159 CHECKBOX aVar1[nStart1] VAR aGet1[nStart1]                                   OF oDlg PIXEL UPDATE
              CASE ('[N]' $ reportd-&gt;fieldname)
                   aGet1[nStart1] := reportd-&gt;last02n
                   @nRow,159 GET aVar1[nStart1] VAR aGet1[nStart1] SIZE 50, 12    PICTURE &quot;999999999.99&quot;  OF oDlg PIXEL UPDATE
              OTHERWISE
                   aGet1[nStart1] := reportd-&gt;last02c
                   @nRow,159 GET aVar1[nSTart1] VAR aGet1[nStart1] SIZE 50, 12    PICTURE &quot;@!&quot;            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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Trouble Creating Dialog, Say and Get from data
Posted: Wed Apr 28, 2010 02: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion