July 22, 201312 yr Hi, I have a bunch of portals with a delete portal row button and it works fine. I am just wondering if there is a script set in FM where the portal row I want to delete gets highlighted so I know if I clicked the correct "x" button to delete the portal row? Thanks
July 22, 201312 yr You obviously want to combine this with a confirmation dialog (if you haven't already done so); otherwise the row gets briefly highlighted, then it's gone anyway … You can conditionally format one or more fields in the portal row (not the row per se, alas) with a condition like $$selected = portalTO::keyField; then write a script like … Set Variable [ $$selected ; portalTO::keyField ] // triggers CF highlighting Refresh Window Show Custom Dialog [ "Really delete?" ; "bla bla"; "Yes" ; "No" ] If ( Get ( LastMessageChoice] // if delete button was pressed Delete Portal Row [No dialog] End If Set Variable [ $$selected ; "" ] Commit Record Alternatively (or additionally), capture the name of the row (whatever identifies the record best) and display it in the dialog box.
July 24, 201312 yr Author You obviously want to combine this with a confirmation dialog (if you haven't already done so); otherwise the row gets briefly highlighted, then it's gone anyway … You can conditionally format one or more fields in the portal row (not the row per se, alas) with a condition like $$selected = portalTO::keyField; then write a script like … Set Variable [ $$selected ; portalTO::keyField ] // triggers CF highlighting Refresh Window Show Custom Dialog [ "Really delete?" ; "bla bla"; "Yes" ; "No" ] If ( Get ( LastMessageChoice] // if delete button was pressed Delete Portal Row [No dialog] End If Set Variable [ $$selected ; "" ] Commit Record Alternatively (or additionally), capture the name of the row (whatever identifies the record best) and display it in the dialog box. Actually I think the second way would be better. For example, Because each portal row begins with the field "date" I can maybe capture the date and insert it in the dialogue. Do you know the easiest way I can do that? Oh its ok I figured it out using a script parameter thanks!
July 24, 201312 yr Actually I think the second way would be better. For example, Because each portal row begins with the field "date" I can maybe capture the date and insert it in the dialogue. Do you know the easiest way I can do that? Oh its ok I figured it out using a script parameter thanks! Not sure how a Script Parameter would help when clicking on an arbitrary field…? Just capture the necessary data from the portal row: Set Variable [ $myDate ; GetAsText ( portalTO::myDateField ) ] // the date you want to display Show Custom Dialog [ "Delete " & $myDate & "?" ; "Really delete record from date " & $myDate & "?" ; "Yes" ; "No" ] // use date in dialog If ( Get ( LastMessageChoice] // if delete button was pressed Delete Portal Row [No dialog] End If You can also use portalTO::myDateField directly in the calculation for the dialog box, but IMO this style is a bit clearer.
Create an account or sign in to comment