APPEND with for

This forum is meant for questions about the Visual FoxPro Language support in X#.

Post Reply
User avatar
COMSYSplus
Posts: 7
Joined: Sun Nov 26, 2023 8:48 pm
Location: Deutschland

APPEND with for

Post by COMSYSplus »

Hi everyone,

we just try to convert your VFP 9.0 software applications zu x#.

We get some problems with "APPEND for". The "for" clauses appends less data then our VFP code ( which works well )

Is something different in x#, have we to set something ?

Thank you very much for helping.

Peter
User avatar
robert
Posts: 4572
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: APPEND with for

Post by robert »

Peter

Can you post a sample of the code and data?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
COMSYSplus
Posts: 7
Joined: Sun Nov 26, 2023 8:48 pm
Location: Deutschland

Re: APPEND with for

Post by COMSYSplus »

Robert,

we did it with following Code:

XSharp:

COPY FILE "Zwischen\f_artike_kopie.DBF" to "Zwischen\005_f_artike_use.dbf"
COPY FILE "Zwischen\f_artike_kopie.FPT" to "Zwischen\005_f_artike_use.fpt"
COPY FILE "Zwischen\f_artike_kopie.CDX" to "Zwischen\005_f_artike_use.cdx"

select 0
use "Zwischen\005_f_artike_use" alias artikel exclusive
delete all for recno() > 0
pack
use
select 0
use "Zwischen\005_f_artike_use" alias artikel

append from "Zwischen\f_artike_kopie" for ALLTRIM(Artiknr) < "2000"


=========================================================================================

VFP:

COPY FILE "Zwischen\f_artike_kopie.DBF" to "Zwischen\005_f_artike_use.dbf"
COPY FILE "Zwischen\f_artike_kopie.FPT" to "Zwischen\005_f_artike_use.fpt"
COPY FILE "Zwischen\f_artike_kopie.CDX" to "Zwischen\005_f_artike_use.cdx"

select 0
use "Zwischen\005_f_artike_use" alias artikel exclusive
Zap
use
select 0
use "Zwischen\005_f_artike_use" alias artikel

append from "Zwischen\f_artike_kopie" for ALLTRIM(Artiknr) < "2000"

=========================================================================================

The result is:

XSharp: ==> Datensätze nach append for: 16 <==
VFP: ==> Datensätze nach Append for: 37 <==


I attach the tables which we are using als zip-file.

Peter
Attachments
f_artike_kopie.zip
(13.53 KiB) Downloaded 65 times
User avatar
robert
Posts: 4572
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: APPEND with for

Post by robert »

Peter,
There is an error in the UDC.
If you add this to the top of your file, then it should work:

Code: Select all

#command APPEND [FROM <(file)> ]                                        ;
         [__FOXLIST__ <fldlist>]                                        ;
         [__FOXWILD__ <fldwild> ]                                       ;
         [FOR <lfor>]                                                   ;
         [WHILE <lwhile>]                                               ;
         [NEXT <nNext>]                                                 ;
         [RECORD <rec>]                                                 ;
         [<rest:REST>]                                                  ;
         [ALL]                                                          ;
         [TYPE] [<type: FOXPLUS,FOX2X,DIF,MOD,SDF,SYLK,WK1,WKS,WR1,WRK,CSV,XLS,XL5,XL8 >] ;
         [SHEET <sheet>]                                                ;
         [AS <nCodePage>]                                               ;
                                                                        ;
      => DbAppFox(                                                      ;
                     <(file)>, iif( <.type.>,#<type>,"DBF"),            ;
                     iif( <.fldlist.>, <!fldlist!>, <!fldwild!>),       ;
                     <{lfor}>, <{lwhile}>, <nNext>,                     ;
                     <rec>, <.rest.> ,                                  ;
                     <(sheet)>, <nCodePage>                             ;
                   )
Btw we do not support all the types in the command yet.
Supported are:
- standard dbf (no type clause)
- foxplus
- fox2x
- csv
- sdf

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply