Jump to content
Server Maintenance This Week. ×

Multiple "And" Find Script


This topic is 4641 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello,

I have a table named Food where I list several food characteristics.

Relevant Food table fields:

__kpFoodID

FoodName

FoodCategory

FoodSubCategory

BloodTypeASecretor

BloodTypeANonSecretor

BloodTypeBSecretor

BloodTypeBNonSecretor

BloodTypeABSecretor

BloodTypeABNonSecretor

BloodTypeOSecretor

BloodTypeONonSecretor

So, depending on the persons BloodType and wether he/she is Secretor or Non Secretor a particular Food can be: Avoid (detrimental), Beneficial, Neutral.

My final objective is to have four types of food report, one for each blood type, based on the food suitability: Avoid, Beneficial, Neutral

FOOD REPORT

BLOOD TYPE:

Avoid Beneficial Neutral

Food Category Food Category Food Category

Food SubCategory Food SubCategory Food SubCategory

FoodName FoodName FoodName

So I need 4 scripts, one for each blood type, that will find and sort the records. Finally, I will associate each script to its button: A Type Food, B Type Food, AB Type Food, O Type Food.

I have a working Find and Sort script based on just one criteria for each blood type.

So, for the A Blood Type I have the following script to find out the "Beneficial" foods:

Find_BT_A_Beneficial script is the following

Enter Find Mode [ ]

Set Field [ Food::BloodTypeASecretor; "Beneficial" ]

New Record/Request

Set Field [ Food::BloodTypeANonSecretor; "Beneficial" ]

Set Error Capture [ On ]

Perform Find [ ]

Perform Script [ “Food Record Sorting”]

Food Record Sorting Script:

Enter Browse Mode

Go to Layout [ “Alimentos Recomendados” (Food) ]

Sort Records [ Specified Sort Order: FoodCategory::FoodCategory; ascending FoodSubcategoy::FoodSubcategory; scending Food::FoodName; ascending ]

[ Restore; No dialog ]

Enter Preview Mode [ Pause ]

Enter Browse Mode []

Go to Layout [ original layout ]

I would like to be able to modif ythe Find_BT_A_Beneficial script so that it finds and sorts all the food records that are: Avoid, Beneficial & Neutral for both Blood Type A Secretors and Blood Type A NonSecretors.

Since I have tried without success some modifications, my question is:

How can I modify the Find_BT_A_Beneficial script so that the found set includes:

Foods to Avoid & Beneficial & Neutral for the Secretor Blood Type A

&

Foods to Avoid & Beneficial & Neutral for the NonSecretor Blood Type A?

Thanks

Link to comment
Share on other sites

It would probably be best to have another table with the following fields:

• FoodID

• BloodType

• Secretor (Boolean)

• Compatibility (Avoid/Beneficial/Neutral)

IIUC, it would have 8 related records for each food (4 blood types * 2 secretor categories). This would enable you to easily produce any type of report you can possibly imagine - including reports that need to list the same food twice (which is not possible with your current structure).

How can I modify the Find_BT_A_Beneficial script so that the found set includes:

Foods to Avoid & Beneficial & Neutral for the Secretor Blood Type A

&

Foods to Avoid & Beneficial & Neutral for the NonSecretor Blood Type A?

Doesn't this include all records?

Link to comment
Share on other sites

Hello Comment,

Thanks for looking into my question.

You are right I will have to undo my current structure and create the table that you suggest.

Doesn't this include all records?

No. It just includes all the records as for the Blood type A.

WIth my current structure for a particular Food record, you can generate 4 general report groups:

Food records that are Avoid (detrimental), Beneficial, and Neutral for people with blood type A.

Food records that are Avoid (detrimental), Beneficial, and Neutral for people with blood type B.

Food records that are Avoid (detrimental), Beneficial, and Neutral for people with blood type AB.

Food records that are Avoid (detrimental), Beneficial, and Neutral for people with blood type O.

Thanks again for providing a useful point of view.

Link to comment
Share on other sites

This topic is 4641 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.