Saucepan Posted July 19, 2006 Posted July 19, 2006 having some trouble with a loop i created... im running the loop to find a sertain varible. if it finds the varible i want it to break on the record the varible is in, and if it doesnt find the variable i simply want it to create a new record with the new variable in it... as of right now i get it to find the variable, and break, but i cant get it to create new a record! help please...
Inky Phil Posted July 19, 2006 Posted July 19, 2006 It would help if you can post the script that you have. I would be intrigued how you determine a record with a variable attached Phil
Saucepan Posted July 19, 2006 Author Posted July 19, 2006 (edited) k.. here we go... setvariable[$$rmail; report::report_mail] goto layout["people"(people)] setvariable[$$count; Count(people::people_id)] goto record[first] setvariable[$$j; 1] loop setvariable[$$pmail; people::people_mail] exit loop if[$$pmail=$$rmail] exit loop if[$$count=$$j] goto record[next] setvariable[$$j; $$j + 1] end loop if[$$pmail=$$rmail] setvariable[$$id; people_id] goto layout["report"(report)] new record setfeild[report::report_people_id; $$id] exit script[] end if new record setvariable[$$id_new; people_id] setfield[people::people_mail; $$rmail] goto layout[report] new record setfield[report::report_id; $$id_new] thats what im getting... its not working though. i cant get the darn thing to fill in the new email and create a new record (for the new person that doesn´t already exists). everything else works fine... Edited July 19, 2006 by Guest
Saucepan Posted July 19, 2006 Author Posted July 19, 2006 i should explain a little... the report_mail thing is the variable, this is where i enter my diffrent values. thats the value i want to compare to the existing values in the people table. ya c, folks?
Inky Phil Posted July 19, 2006 Posted July 19, 2006 When you go to each record what is it precisely that you want to check?
Saucepan Posted July 19, 2006 Author Posted July 19, 2006 i want to check if the email adress is the same as in the mail i got sent to me. it does that all fine and well, the thing is that as my people tabel grows larger its gonna slow down this search. thats why i need to find a faster model...
Inky Phil Posted July 19, 2006 Posted July 19, 2006 Ah - so you are looking to go faster. Try this Establish a relationship between a global and the field in the table that you wish to check. Then set the global to the email that you are looking for Then use the Count()function to check if a record (or records) exist for that relationship. Set a variable with it If variable is more than 0 (ie person exists) - do whatever If not do whatever 1 global, 1 relationship, 1 variable. A short script. No loops. Done. That way no matter how big your file gets the find will be quick. HTH Phil
Saucepan Posted July 19, 2006 Author Posted July 19, 2006 will do, sounds greeat! one thing though: "global"? how do i do that? i probably already know, im using a swedish copy though so the words might be mixed up...
Inky Phil Posted July 19, 2006 Posted July 19, 2006 A Global is a field where the storage is set (under storage options) to global ie one value for all records. It acts like a variable but is set up through the define database>fields window. You will have to set this up because you cannot base a relationship on a variable Hope it does what you want Phil
Saucepan Posted July 19, 2006 Author Posted July 19, 2006 thanks buddy! ill get to work with this right away... stay tuned for the thrilling concluesion...
Saucepan Posted July 19, 2006 Author Posted July 19, 2006 (edited) k.. this is my code now: it cant find any of my old records, and it automaticly deletes the old emailadresses from all previous records?!? what am i doing wrong? setvariable[$$rmail; report::report_mail] setvariable[$$count; Count(report::report_mail; people::people_mail] goto layout["people::people"(people::people)] if[$$count>0] setvariable[$$id; people_id] goto layout["report"(report)] new record end if if[$$count<=0] new record setvariable[$$id_new; people_id] setfield[people::people_mail; $$rmail] goto layout[report] new record setfield[report::report_id; $$id_new] end if Edited July 19, 2006 by Guest
Recommended Posts
This topic is 6704 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 accountSign in
Already have an account? Sign in here.
Sign In Now