Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting filter conditions based on records in a table
Message
De
05/12/2005 09:34:56
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01074912
Message ID:
01074918
Vues:
11
>I have a users table which stores the user number and other conditions. The table may look like:
>
>
>
>Userno       Attribute         Value
>-------------------------------------
>3            Country           Morocco
>3            Country           Ukraine
>3            Factory           New Line
>3            Factory           Woven Mod
>3            Dept              T58
>3            Dept              T59
>
>
>Using the data above I want to set a filter condition on another table prior to printing named planrep. Therefore how can I set up a filter condition so it reads the table above and sets the filter on my planrep table? So for user number 3 it will set the filter so that the country=Morocco and Country=Ukraine.
>
>Is there any eay way to do this?

I don't know an easy way to do a filter, but for a report, you can create a query.

Option 1: Use a sub-query.
select * from OtherTable where Country in;
  (select Value from Conditions where UserNo = 3 and Attribute = "Country");
  into cursor Temp
report form ...
Option 2: Use the join syntax.
select OtherTable.*;
  from Conditions join OtherTable on Conditions.Value = OtherTable.Country;
  where UserNo = 3 and Attribute = "Country";
  into cursor Temp
report form ...
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform