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

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

Recommended Posts

Posted

Hey all. Wanting to write a script that removes all related records displayed in a portal row. Currently I have several scripts a user can run that will create a certain number of related records (in this case, 5 days):

 

Freeze Window
Set Variable [$weekid; Value:${Weeks and Data}::week id]
Set Field [Weeks and Data::global_days_count; 5]
Go to Layout ["Hours" (Hours")]
Loop
  Exit Loop If [${Weeks and Data}::global_days_count = 0]
  New Record/Request
  Set Field [Hours::week id; $weekid]
  Set Field [Weeks and Data::global_days_count; ${Weeks and Data}::global_days_count - 1]
End Loop
Go to Layout ["Weeks and Data" (Week and Data)]

 

Now, the user can create as many "days" as he/she wants. I want this script to remove all the related records (days) no matter how many have been created. I have written a script that potentially just reverses the above, but I'm concerned that it *may* remove all the records within the Hours table, and at this point I would rather get a pro's opinion when so much data is at steak. 

 

Thank you all for your help.

Posted

What are you trying to accomplish in real world terms? The point?

 

hmm. i'm unsure what you mean by "real world terms" - i thought this forum was a place to come when a layman is seeking help. i thought i laid out my intentions pretty well in the OP. the database is merely a small project i've been working on developing since i started trying to learn filemaker. the application tracks hours worked and gives an estimated paycheck amount. sometimes i try to look ahead at what i may earn by entering supposedly worked hours. instead of clearing every field, i'd rather just delete the records.

Posted

Try something like this...

If[ Count ( RelatedTable::id ) // make sure related records exist]
    Go To Related Records[ RelatedTable ; RelatedTablesLayout ]
    Delete All Records
    Go to Layout[Original]
EndIf
  • Like 1

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