Show a Detail Window Pop-Up from a List View Dynamically

This code allows you to show a Pop-Up Window from a list or table view dynamically...so you don't have to code a method for each "Show Detail Popup" button.

This code allows you to show a Pop-Up Window from a list or table view dynamically...so you don't have to code a method for each "Show Detail Popup" button.

To use, either pass in the form to show as an argument, or even better, just name the button that gets clicked the same as the form name that you want to show! It will automatically load the correct record, and show the form in a window.

Note: Only works on tables with a single PK (no combo-keys)Â

var formToShow = arguments[0]
if(!formToShow) 
    formToShow = application.getMethodTriggerElementName() 

var formName = application.getMethodTriggerFormName() 
var pk = databaseManager.getTable(forms[formName].controller.getServerName(),  forms[formName].controller.getTableName()).getRowIdentifierColumnNames()[0]
var pkValue = forms[formName].controller.getDataProviderValue(pk)

forms[formToShow].controller.loadRecords(databaseManager.convertToDataSet([pkValue])) 
application.showFormInDialog(forms[formToShow],'Details',true);