Page 1 of 1

How to do a DCSAY GET of all fields of a DBF

Posted: Sat Aug 31, 2019 9:25 am
by alepap
Ho can I do the get for all Fields

Code: Select all

   @ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT OBJECT oStaticEditPage SIZE mWinCol,mWinRow ;
      
      // TAB1
      @  0,0 DCTABPAGE oTabPage1 CAPTION 'ACTION'        SIZE mWinCol-0,mWinRow-0 PREOFFSET 0 POSTOFFSET 90 PARENT oStaticEditPage ;
                                 GOTFOCUS {|| DC_GetRefresh(oTabPage1) , ;
                                              SetAppFocus(oGet1) } ;
                                 
      DCSETPARENT TO oTabPage1
      DCSETRESIZE TO DCGUI_RESIZE_REPOSONLY_Y

         row := 5
         col := 5
         
         FOR i := 1 TO nMax
              mFieldName := ALLTRIM(aStru[i,1])
              @ row++,col DCSAY mFieldName GET &mFieldName PICTURE "@!"
         NEXT


      DCSETPARENT TO
      DCSETRESIZE TO
      
I have all the Fields in aStru array.
I have the Field Name correct. But the &mFieldName does not work.

Thank you

Alexandre

Re: How to do a DCSAY GET of all fields of a DBF

Posted: Mon Sep 02, 2019 12:51 am
by Victorio
can you try this :
@ row++,col DCSAY &mFieldName GET &mFieldName PICTURE "@!"

Re: How to do a DCSAY GET of all fields of a DBF

Posted: Mon Sep 02, 2019 8:07 am
by Tom
Use missed to populate the var with the field contens. This works with any table called "test"::

Code: Select all

FUNCTION Main()
LOCAL GetList := {}, nCtr, cField
USE test NEW
FOR nCtr := 1 TO FCount()
  cField := FieldName(nCtr)
  &cField := FieldGet(nCtr) // <- you missed this
  @ nCtr,1 DCSAY cField GET &cField
NEXT
DCREAD GUI ADDBUTTONS FIT
RETURN NIL

Re: How to do a DCSAY GET of all fields of a DBF

Posted: Mon Sep 02, 2019 8:54 am
by Tom
This will work on a table without moving the table fields to memvars:

Code: Select all

FUNCTION Main()
LOCAL GetList := {}, nCtr, cField
USE test NEW
FOR nCtr := 1 TO FCount()
  cField := "test->"+FieldName(nCtr)
  @ nCtr,1 DCSAY cField GET &cField
NEXT
DCREAD GUI ADDBUTTONS FIT
RETURN NIL