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

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

Recommended Posts

Posted

I'm trying to come up with a way to create a generic field that isn't necessarily tied to any of my other table's records. The purpose is so that a user could enter text into that field and the text would then be inserted (via script) globally for all the records in the found set.

For example: I've got 20 different records, each need one specific date. Rather than going to each record and adding the date, I'd like to be able to enter the date into this "Global" field and when I hit a button, a script would run that would insert that "Global" field's text into the 20 records.

Writing the script isn't the problem. I can't seem to come up with a way to display this "Global" field in my related tables. I don't want to add it to my related tables because they all have many records in them. The way I imagine it to work is that there would be a table with only one, empty record in it. I would be able to populate that record from one of my related tables and then clear it after I've run my script.

I hope this makes sense, I've now exhausted my humble bag of tricks. Got any ideas???

Posted

...What?

I came onto the forums to ask a question, but i forgot what it was, so instead i'll TRY and help you.

Ok, firstly, it doesnt matter where you put your field or what it is as long as it is defined as global. I.e. you could make a seperate table for your globals and not have it related to anything, and because your field is defined to store its data globally, you could place it in any layout you would like, and manipulate its value through script or manually from any point of the database, once again regardless of relationships.

So, now that we've worked that out, ill just show you a quick script you could use.

Allow User Abort [Off]

Freeze Window

SetVar[$CurrentRecord ; Get(RecordNumber)]

Go to Record [First]

Loop

SetField[TableContainingField::FieldToBeSet ; GlobalTable::GlobalField]

Go to Record [Next;Exit After Last]

End Loop

SetField[GlobalTable::GlobalField; "" ]

Go to Record [by Calculation ; $CurrentRecord]

Any trouble, or if this wasn't what you wanted, post again

~Genx

Posted

Add an error checking routine in that loop to check for locked records. Then add a routine to revisit or report the records that were locked.

Posted

Thanks, I think with a little tweaking, that should be what I need. In my description of my problem, I referred to this imaginary field as "global", when in fact, it hadn't occurred to me to actually set up the field that way. Sometimes the easiest answers are right in front of you, eh?

Thanks for the tip,

Cheers!

This topic is 6856 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.