Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #10278

Re: Write to a dynamically create dbf file

From "Wolfgang Riedmann" <wriedmann@gmail.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Write to a dynamically create dbf file
Date 2017-03-13 10:54 +0100
Message-ID <ein8ibFpfnbU1@mid.individual.net> (permalink)
References <5acf7471-a040-404f-875c-da510487f6f7@googlegroups.com>

Show all headers | View raw


Hi Michael,

this is code I'm using when the structures of both DBFs are not the
same, but only a few fields:

nLen	:= oTarget:FCount
for nI := 1 upto nLen
  nPos := oSource:FieldPos( oTarget:FieldName( nI ) )
  if nPos != 0
    oTarget:FieldPut( nI, oSource:FieldGet( nPos ) )
  endif
next

Wolfgang


beerhand wrote:

> Hi all,
> 
> it is a long time ago I used CAVO (2.6). I "mastered" to dynamically
> create a "new dbf" file that was based on rows of an "existing dbf"
> file (DBServer). Now I need to fill the "new dbf" from another "from
> dbf" file.
> 
> I am able to browse/append the "new dbf" through the StdDataWindow.
> The problem now is that I want to fill the rows  with data and do not
> know how to access the fieldnames of the "new dbf". Using the mehtod
> self:server:fieldget(i) I get a string with the corresponding
> fieldname.  e.g. (new dbf) self:server:fieldget(1) = "Alpha",
> self:server:fieldget(2) = "Beta", etc
> 
> Now I need to write data into this field (and the other fields). I do
> not know how to access this like self:server:fieldget(1) := value.
> 
> I can use Method DataServer:DBStruct but still have no idea how the
> access the individual fields of the "new dbf"
> 
> 
> Any help and ideally an example is highly appreciated. By the way I
> am "just" an amateur developer.
> 
> Thanks Michael
> 
> Example:
> 
> "Existing dbf" dbServer:
> ----------------------------------------------
> Name, C, 50 
> ----------------------------------------------
> Alpha       
> Beta    
> Gamma
> +
> +
> ----------------------------------------------
> 
> "from dbf" existing dbServer
> ----------------------------------------------
> ID, N,12    . Year  -   Beta, C 50   -  Value, N, 12
> ----------------------------------------------
> 1             2017       Alpha           1000
> 2             2017       Beta            2000
> 3             2018       Alpha            500
> 4             2019       Gamma            100
> 5             2017       Beta            1000
> 6             2018       Alpha            100
> +
> +
> -----------------------------------------------
> 
> 
> "NEW DBF" - dynamically create dbf file (access through
> stdDataWindow) but do not know how to fill the rows
> ---------------------------------------------- Alpha, N,12   . Beta,
> N 12   -  Gamma - N, 12   <- how to access these fields?
> ---------------------------------------------- ???              ????
> ????  +
> +
> ----------------------------------------------
> 
> 
> Result should look like this:
> 
> "NEW DBF" filled by detail "from dbf" 
> Year, N,4 - Alpha, N,12        .  Beta, N 12   -     Gamma - N, 12
> ----------------------------------------------------------------------
> -- year        Sum("alpha", year)    Sum("beta", year)  Sum("Gamma",
> year)
> ----------------------------------------------------------------------
> -- 2017        1000                  2000+1000          0 2018
> 500                   0                  0 2019        0
> 0                  100 +
> +
> ----------------------------------------------------------------------



-- 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Write to a dynamically create dbf file beerhand <michael_j_schmidt@yahoo.de> - 2017-03-13 01:49 -0700
  Re: Write to a dynamically create dbf file Franz Rachbauer <office@rachbauer.org> - 2017-03-13 10:31 +0100
  Re: Write to a dynamically create dbf file "Wolfgang Riedmann" <wriedmann@gmail.com> - 2017-03-13 10:54 +0100
  Re: Write to a dynamically create dbf file beerhand <michael_j_schmidt@yahoo.de> - 2017-03-13 03:48 -0700
  Re: Write to a dynamically create dbf file beerhand <michael_j_schmidt@yahoo.de> - 2017-03-13 03:50 -0700
    Re: Write to a dynamically create dbf file beerhand <michael_j_schmidt@yahoo.de> - 2017-03-13 04:07 -0700
      Re: Write to a dynamically create dbf file Johan Nel <johan.nel@xsinet.co.za> - 2017-03-13 14:04 +0200

csiph-web