Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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...

Posted (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 by Guest
Posted

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?

Posted

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...

Posted

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

Posted

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...

Posted

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

Posted (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 by Guest

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 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.