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

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

Recommended Posts

Posted

I'm stuck in severe dense mode (working two full-time jobs does that to you) so forgive me for the simplicity of this question:

I have two related tables: Alpha (parent), and Bravo (child); the text field that I want to clear in Bravo is named cap_text. Currently, Bravo has four records.

The script I'm cobbling together goes to different fields throughout the solution to clear, but not delete records--which is what the client wants. The problem is I'm having a devil of a time trying to code a simple looping script (using GTRR) to find the (four) cap_txt records and clear them.

How should the script be defined?

TIA for your help,

Rich

Posted

Stay in Alpha. No need to GTRR.

Script:

Replace Field Contents [ No Dialog ; Bravo::Field1 ]

Replace Field Contents [ No Dialog ; Bravo::Field2 ]

Replace Field Contents [ No Dialog ; Bravo::Field3 ]

Replace Field Contents [ No Dialog ; Bravo::Field4 ]

You do not even need to have the Bravo fields on the current layout.

LaRetta

Posted

Thanks, LaRetta, but I don't think that'll work in my case because upon reflection, I wasn't clear enough when I wrote my question.

The cap_txt field is one of many fields in the Bravo table. What I want to do is clear the contents of cap_txt in all of Bravo's records.

In Bravo, which could have a scores or more of records created through the portal from Alpha, it's a one-to-many relationship, isn't it? So, shouldn't I use a looping-type script (or an inelegant, scripted find request)?

Posted

Well, I thought I understood you. But maybe I didn't explain it well enough. Here's a demo file.

First switch to the Bravo layout and see that there is data in all fields for three different Alpha parent records. You want to blank the fields only for record #3. Now go back to Alpha layout and fire that script by the button. Now go back to Bravo and view the results.

The second 'Replace' script will work depending upon the found set. This is cool because you can then find many parent records if you wish, and handle them all at once. And you can use a calculation to replace the values depending upon many factors - not just blanking them. It is very important that you isolate the parents whose children you wish to replace; and it is important that you truly want to replace ALL children for that parent but that's why we're Developers ... we're supposed to know to check for those things and allow for them within the script. That is where I went wrong with you because I didn't explain it enough.

If what you want is different than this, please let us know and we'll take you in another direction! :wink2:

ReplaceChildValues.zip

Posted

I write to you more than I do my family, LaRetta--and for that they thank you. :

You're close: it's not the horizontal axis (record) that needs to be cleared, but the vertical axis. Say Field 3 is populated via a portal from Alpha; if I could clear the contents Field 3 in Bravo then that would be the ticket.

Thanks for your patience!

Posted

Uh, I still don't get it. You can clear any field you wish - you don't have to clear them all. You can have 10 fields and only choose to clear 1 for all child records of that one parent. The portal has nothing to do with it ... a portal is just a view of all Bravo records (children) related to that specific Alpha record. Where are we still miscommunicating?

Oh, your mom wants you to bring home milk. ;-)

Posted

I believe I confused you with my first script, using 4 FIELDS. You said there were 4 Bravo RECORDS.

You would use only ONE Replace Field Contents[ NO Dialog ; Bravo::cap_txt ; "" ]

And, to preserve your existing record-set (if you are working in Browse mode), you can do it this way from your Alpha parent record:

New Window

Omit Record

Show Omitted

Replace Field Contents [ NO Dialog ; Bravo::cap_txt ; "" ]

Close Window

It was all my fault for confusing 4 records with 4 fields. The solution I provided works well with multiple parent records; multiple fields; and multiple child records and ... well, I got carried away. :blush2:

Posted

Let this be a lesson to us all: a single parent will have problems trying to "feed" a lot of children. :S

Actually, there is a real lesson here for me: in my daytime job I'm a technical writer for an airline; I write maintenance and repair procedures for our mechanics to follow so they can maintain/repair our cargo aircraft. (I'm here at work writing one right now; exciting stuff, ailerons.) Even though _I_ think I'm perfectly clear in writing a repair procedure I shouldn't automatically assume that the reader can't possibly misunderstand what I've written.

Thanks again, LaRetta--I'll give your instructions a shot when I go to my other job tonight.

Cheers!

Pee Ess: It worked like a charm. Thanks!

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