AnsweredAssumed Answered

Remove related info when unchecked

Question asked by CharlotteLasek on Jan 19, 2015
Latest reply on Jan 19, 2015 by CharlotteLasek

Title

Remove related info when unchecked

Post

Hi there,

Thanks in advance to PhilModJunk for Loop through filters which got my script working this far. It relates Activities that the user chooses to an Event. I want to modify the script to UNrelate an Activity if it's un-checked. Here's my working script for the relating loop:

Set Variable [$Event; value: EventDetails::__pkEventID]
Set Variable [$ActList; value: EventDetails::checkbox_Activities]
Loop
Set Variable [$K ; value: $K +1]
Exit Loop if [$K > ValueCount ($ActList)]
Freeze Window
Go to Layout ["Activities for Event" (activities_EVENT)]
Enter Find Mode []
Set Field [activities_EVENT::__pkActivityID; GetValue ($ActList ; $K)]

Set Error Capture [On]
Perform Find []
Set Field [activities_EVENT::_fkEventID ; $Event]

End Loop
Go to Layout [original layout]

So, if an activity is NOT checked (or is UN-Checked) it won't be in the list ($ActList) and it won't be found with Perform Find. I need to also find related activities that are NOT in $ActList.

I'm going to try a second loop that 1) finds all the related activities, 2) omits the $ActList results, and 3) removes the EventID – but maybe there's an easier way? Any help is much appreciated! 

Outcomes