Filtering on Browse Page Values with Both Browse page and Filter Controls Within an Object Group

How Can We Help?

< Back

Using the SQL Connector integration to return values to a Browse Page will normally work, but when the Browse Page and filter controls are within an object group, we need to use scripts in the Browse Page editor (i.e Managed Object property) to pass the filter parameter values to the query (stored procedure in the below example) used to return the result set to the Browse Page.

Keep in mind that the filter keywords need to have the AutoPostBack set to True within the object group (if the filter control is a Drop Down or Lookup control) for the Browse Page to read the parameterized inputs.

The object group also needs the controls to map back the values selected from the Browse Page.

//Please place the codes below under the Browse Page's ManagedObject property and modify the control names necessarily 
public void NB10Line_SelectUser_OnLoad()
{
    System.Data.DataTable dt = new System.Data.DataTable();
    System.Data.DataSet ds = new System.Data.DataSet();

    try

    {
        string userId = activity.GetControlValue("NB30260UserId", groupId, lineNumber); 
        // Getting the filter parameter value from the object group 

        using (System.Data.SqlClient.SqlConnection conn = new 
        System.Data.SqlClient.SqlConnection(customSetting.Value(process.Company, @"Connections\XMInternal")))
        // the settings value can be dragged from the connection explorer
        

        {
            conn.Open();
            System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand("sp_GetUser", conn);
            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@UserId", userId)); 
            // passing the filter parameter value from the object group to the store procedure. 
            dt.Load(command.ExecuteReader());

        }
        ds.Tables.Add(dt);
    }
    catch (Exception ex)
    {
        System.IO.File.WriteAllText(@"C:\temp\test.txt", ex.Message);
        // for debugging purpose, please comment out once working.
        
    }
    return ds;
}

For a more detailed configuration instruction, read Using Object Group Parameters on Browse Page.

 

 

Comments are closed.

This is the legacy version of the XMPro Documentation site. For the latest XMPro documentation, please visit documentation.xmpro.com

X