Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to do this replace
Message
De
14/09/2007 01:44:21
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
13/09/2007 08:49:11
Mk Sharma
Shrishti Solutions
Mumbai, Inde
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01254065
Message ID:
01254276
Vues:
11
Hi,

the tricky part is that you only give the start of your tax range.
There may be better ways, but this one works
*get the date of taxrate
SELECT;
 MAX(cur2.Effdate) AS Effdate,;
 cur1.billdate;
 FROM schild          AS cur1;
 INNER JOIN taxmaster AS cur2;
 ON cur1.billdate=>cur2.Effdate;
 INTO CURSOR curHelp;
 GROUP BY 2

*get the taxrate for a day
*two steps for VFP 9.0
SELECT ;
 cur1.billdate,;
 cur2.taxrate;
 FROM curHelp         AS cur1;
 INNER JOIN taxmaster AS cur2;
 ON cur1.Effdate=cur2.Effdate;
 INTO CURSOR curHelp

*write the taxrate back
INDEX ON billdate TAG billdate

SELECT schild
SET RELATION TO billdate INTO curHelp

REPLACE;
 taxrate WITH curHelp.taxrate;
 ALL

*clean up
SET RELATION TO
USE IN curHelp
Agnes
>i have 2 dbfs
>
>1. taxmaster.dbf
>
>taxmaster.dbf have 2 fields
>
>
>
>Effdate  d      && effective date
>taxrate  n(5,2) && tax rate
>
>records in taxmaster.dbf    && no of records can change in taxmaster.dbf
>
>Effdate      Taxrate
>01.04.2007     0.00
>15.06.2007     4.00
>01.07.2007    12.50
>
>
>
>
>schild.dbf have 6 fileds && more than 5000 records with diffrent billdates.
>
>billdate d
>billno   c(8)
>product  c(50)
>quantity n(10,3)
>rate     n(10,2)
>taxrate  n(5,2)
>
>
>billdate     billno      product       quantity      rate   taxrate
>02.04.2007   001001      abc             5           500.00   ??       should be  0.00
>03.04.2007   001001      abc             5           500.00   ??       should be  0.00
>04.04.2007   001001      abc             5           500.00   ??       should be  0.00
>05.05.2007   001001      abc             5           500.00   ??       should be  0.00
>04.06.2007   001001      abc             5           500.00   ??       should be  4.00
>05.06.2007   001001      abc             5           500.00   ??       should be  4.00
>08.06.2007   001001      abc             5           500.00   ??       should be  4.00
>10.07.2007   001001      abc             5           500.00   ??       should be 12.50
>12.07.2007   001001      abc             5           500.00   ??       should be 12.50
>18.07.2007   001001      abc             5           500.00   ??       should be 12.50
>21.07.2007   001001      abc             5           500.00   ??       should be 12.50
>25.07.2007   001001      abc             5           500.00   ??       should be 12.50
>
>
>
>
>i want to update taxrate in schild.dbf from taxmaster.dbf as per billdate.
>
>
>warm regards,
>mk.
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform