Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Searching by two fields
Message
De
20/09/2000 10:15:21
Liam O'Hagan
O'Hagan Programming Ltd
Irlande
 
 
À
20/09/2000 09:56:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00418492
Message ID:
00418504
Vues:
38
Hi Linda,

How you approach this depends on what you're trying to do.

If you need to locate the first record matching your search expression you could try

LOCATE FOR shift_form.sr_shift_date = {date} and shift_form.sr_shift_time = "shifttime"

or if you were to create an index on the date and shift you could use SEEK which would return a quicker result in a large table.

In both of these cases FOUND() will return .F. if no record exists

If you need to return a cursor containing records which match the search expression you could use

SELECT * from shift_form WHERE sr_shift_date = {date} and sr_shift_time = "shifttime" INTO CURSOR curSomeName

In this case _tally will contain the number of records found.

HTH

Liam




>Hi Im am fairly new to vfp i am working on searching the table by two fields the first field is the date the second field is the shift .iam using a table view and i am able to make it search by the first field but it wont search by the second field. any suggestions here is the code i have been using
>
>if LOOKUP (shift_form.sr_shift_date,thisformset.Form1.SR_SHIFT_DATE1.value,;
> shift_form.sr_shift_date) = thisformset.Form1.SR_SHIFT_DATE1.value
> if LOOKUP(shift_form.sr_shift_time,thisformset.Form1.SR_SHIFT_TIME1.value,;
> shift_form.sr_shift_time) = thisformset.Form1.SR_SHIFT_TIME1.value
> thisformset.form2.SR_SWITCH_TYPE1.value = shift_form.sr_switch_type
> thisformset.form2.SR_SHIFT_DATE1.value = shift_form.sr_shift_date
> thisformset.form2.SR_SHIFT_TIME1.value = shift_form.sr_shift_time
>thisformset.form2.tech1.value = shift_form.sr_tech1
>thisformset.form2.tech2.value = shift_form.SR_tech2
>thisformset.form2.tech3.value = shift_form.SR_tech3
>thisformset.form2.tech4.value = shift_form.SR_tech4
>thisformset.form2.tech5.value = shift_form.SR_tech5
>thisformset.form2.tech6.value = shift_form.SR_tech6
>thisformset.form2.action.value = shift_form.SR_action
>thisformset.form2.parties_cont.value = shift_form.SR_contacted
>thisformset.form2.down_time.value = shift_form.SR_down_time
>thisformset.form2.trouble.value = shift_form.SR_trouble
>thisformset.form2.pro.value = shift_form.SR_Procedure
>thisformset.form2.misc.value = shift_form.SR_misc
>thisformset.form2.training.value = shift_form.SR_training
>thisformset.form2.work_per.value =shift_form.SR_wrk_perfomed
>thisformset.refresh()
>thisformset.Form2.show
>thisformset.Form1.hide
>endif
>else
> Messagebox("No Records That Match,Enter New Record or Exit",48,"Message")
> Thisformset.Form1.SR_SHIFT_DATE1.setfocus
>
>endif
Liam O'Hagan
MCP VFP Desktop Apps
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform