August 12, 201114 yr I've actually been struggling with this for a couple days and can't seem to pinpoint the logic: I have a set of records. There is a related portal on the layout. I go to the first record via Go To Record/Request/Page First. Start a loop. If a certain field is empty, Custom Dialog 1 (shows the user the record ID number and a message specifying the problem). Then... If the count of the number of records in the portal is <2, Custom Dialog 2 (shows the user the record ID number and a message specifying the problem). Then... Go to the LAST record in the portal. If the date equals the current date, Custom Dialog 3 (shows the user the record ID number and a message specifying the problem). Then... If ANY ONE OR MORE of the above tests are true (i.e. a dialog is triggered), I want to OMIT the record, once the user has a chance to note the information presented in the dialog(s) for that record, and move on to the next record and repeat ALL of the same tests. If none of these are true, I want to simply move on to the next record in the set and repeat ALL of the same tests. Exit the loop after all the records are reviewed. Sounds simple. I can't seem to do it. I do understand the script steps for creating custom dialogs, counting records in portals, etc. It's the logic that escapes me. I've been messing with Loop, If, Else If and Else (I can't seem to understand the difference between those two), and have considered Case within an IF. But I can't seem to get the sequence right to show all dialogs as needed and then omit that record if necessary. FM11 Advanced on Mac OSX. Thank you...
August 12, 201114 yr Is the portal relationship sorted? I suppose what I'm asking is, what defines which related record shows in the last portal row? Let's assume it's the last created record. Go to First Record Loop #First test If ( isempty ( myField)) set $flag ; 1 Show Dialog End If #Second Test If ( count (relationship_portal::keyField) < 2) set $flag ; 1 Show Dialog End If #Third Test If ( not is empty ( relationship_portal::keyField) // there are related records gtrr ( relationship_portal) go to last record if ( dateField = Get ( CurrentDate) ) set $flag ; 1 Show Dialog Go to Parent Layout End If If $flag =1 Omit Record // you'll end up on the next record Else Go to Record Next, Exit after Last End If End Loop
Create an account or sign in to comment