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


Groups > comp.lang.clipper.visual-objects > #10276 > unrolled thread

Write to a dynamically create dbf file

Started bybeerhand <michael_j_schmidt@yahoo.de>
First post2017-03-13 01:49 -0700
Last post2017-03-13 14:04 +0200
Articles 7 — 4 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  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

#10276 — Write to a dynamically create dbf file

Frombeerhand <michael_j_schmidt@yahoo.de>
Date2017-03-13 01:49 -0700
SubjectWrite to a dynamically create dbf file
Message-ID<5acf7471-a040-404f-875c-da510487f6f7@googlegroups.com>
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
+
+
------------------------------------------------------------------------    

 

[toc] | [next] | [standalone]


#10277

FromFranz Rachbauer <office@rachbauer.org>
Date2017-03-13 10:31 +0100
Message-ID<oa5ou4$drh$1@gioia.aioe.org>
In reply to#10276
Michael,
you can set value of a field:
<oDBServer>:FieldPut(<cFieldID> | <nFieldID> | <symFieldID>, 
<uNewValue>) ---> uValue

eg.
self:Server:fieldput("ALPHA", uValue)
self:Server:fieldput(#ALPHA, uValue)
self:Server:fieldput(1, uValue)

Regards, Franz

Am 13.03.2017 um 09:49 schrieb beerhand:
> 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
> +
> +
> ------------------------------------------------------------------------
>
>
>

[toc] | [prev] | [next] | [standalone]


#10278

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2017-03-13 10:54 +0100
Message-ID<ein8ibFpfnbU1@mid.individual.net>
In reply to#10276
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 +
> +
> ----------------------------------------------------------------------



-- 

[toc] | [prev] | [next] | [standalone]


#10279

Frombeerhand <michael_j_schmidt@yahoo.de>
Date2017-03-13 03:48 -0700
Message-ID<15c3c53c-935a-4e59-83bd-32bc946724cf@googlegroups.com>
In reply to#10276
Am Montag, 13. März 2017 09:49:22 UTC+1 schrieb beerhand:
> 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
> +
> +
> ------------------------------------------------------------------------

Maybe I describe my issue much simpler: I want to fill a dbf (e.g. new.dbf) file that I opened via "file Open dialog". Means I do not have dbserver defined.


new.dbf:Append()
For i:= 1 to 10
  new.dbf:field1 := variable1
  new.dbf:Field2 := variable2
  new.dbf:append()  
Next i

What would be the correct way to access new.dbf:fieldx?

Thanks Michael

[toc] | [prev] | [next] | [standalone]


#10280

Frombeerhand <michael_j_schmidt@yahoo.de>
Date2017-03-13 03:50 -0700
Message-ID<a9df9bd3-3580-438c-8ca2-14bcb83f01c1@googlegroups.com>
In reply to#10276
Am Montag, 13. März 2017 09:49:22 UTC+1 schrieb beerhand:
> 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
> +
> +
> ------------------------------------------------------------------------

Sorry. haven't seen all the responses. I will check Thanks Michael

[toc] | [prev] | [next] | [standalone]


#10281

Frombeerhand <michael_j_schmidt@yahoo.de>
Date2017-03-13 04:07 -0700
Message-ID<1bf25f55-b799-4fb7-aa20-6625b8444b8b@googlegroups.com>
In reply to#10280
Am Montag, 13. März 2017 11:50:43 UTC+1 schrieb beerhand:
> Am Montag, 13. März 2017 09:49:22 UTC+1 schrieb beerhand:
> > 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
> > +
> > +
> > ------------------------------------------------------------------------
> 
> Sorry. haven't seen all the responses. I will check Thanks Michael

Hello All,

thanks evryone for your help - it is working!!!! 
 
Best Regards Michael

[toc] | [prev] | [next] | [standalone]


#10282

FromJohan Nel <johan.nel@xsinet.co.za>
Date2017-03-13 14:04 +0200
Message-ID<oa61nj$2kh$1@dont-email.me>
In reply to#10281
Hi Michael,

Great to hear.  Feel free to ask assistance.

Regards,

Johan


On 2017/03/13 13:07, beerhand wrote:
> A
> Hello All,
>
> thanks evryone for your help - it is working!!!!
>   
> Best Regards Michael



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web