January 31, 201312 yr 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.
January 31, 201312 yr Author 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.
January 31, 201312 yr 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
January 31, 201312 yr Madman411, Thanks. I didn't understand your intent in the OP. your reply spells it out.
Create an account or sign in to comment