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

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
alepap
Posts: 94
Joined: Tue Jul 28, 2015 5:15 am

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

#1 Post 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

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

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

#2 Post by Victorio »

can you try this :
@ row++,col DCSAY &mFieldName GET &mFieldName PICTURE "@!"

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

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

#3 Post 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
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

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

#4 Post 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
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Post Reply