Identify drilldown list columns for Validations : SWEField

We may need to perform certain operation/validation when user drilldown on a particular field in a List Applet.
Vanilla provides a method Drilldown at applet level which can be captured.
The problem here is if there are more than one drilldown list column in applet, clicking on any of them will trigger our validation logic.
 
Solution :
The Workaround to the problem is to use the SWEField property passed to the Applet_PreInvokeMethod  property set. (In the Applet_PreInvokeMethod event in Browser script, if Method Name is “Drilldown” , we will find the Id specific to the drilldown field. This value (Id)  has a specific format (s_1_2_24_0)which changes from list column to list column and record to record. The fourth part of  SWEField property (i.e. 24) remains constant  for a particular list column across all records.
 
Applet browser side sample code:
To Set profile Attribute after identifying drilldown list column.
 
function Applet_PreInvokeMethod (name, inputPropSet)
{              switch(name)
                {
                                case "Drilldown":
                               alert(inputPropSet.GetProperty("SWEField")); // Identify SWEField Value for list Column.Remove in actual code
                                var SWEFieldParts = inputPropSet.GetProperty("SWEField").split("_");
                                if(SWEFieldParts[3] == "24")    // Column SR #
                                {
                                                theApplication().SetProfileAttr("SC_Edit_Drilldown", "Y");
                                }
                }
                return ("ContinueOperation");
}
 
Applet server script sample code:
To Get Profile Attribute which is set at browser side using above code to identify drilldown list column.
 
function WebApplet_PreInvokeMethod (MethodName)
{              if(MethodName == "Drilldown")
                {             
                                if(TheApplication().GetProfileAttr("SC_Edit_Drilldown ") == "Y")
                                {              TheApplication().SetProfileAttr("SC_Edit_Drilldown", "N");
                                // Logic to perform validations
                                }
                }
                return (ContinueOperation);
}
Tags
Recent content