HomeActive Query Builder - Query analysis and modificationProgrammatic modification of SQL queriesHow to check all fields on adding an object to the query

2.3. How to check all fields on adding an object to the query

for .NET Edition use the following DiagramObjectAdded event handler:

private void queryBuilder_DiagramObjectAdded(UnionSubQuery query, DataSource addedObject)
{
    // Select all fields

    CriteriaList cl = query.CriteriaList;
    CriteriaItem ci;
     
    cl.BeginUpdate();
     
    try
    {
        for (int i = 0; i < addedObject.Fields.Count; i++)
        {
            ci = cl.FindField(addedObject, addedObject.Fields[i].Name);
             
            if (ci == null)
            {
                ci = cl.AddField(addedObject, addedObject.Fields[i].Name);
            }
             
            ci.Select = true;
        }
    }
    finally
    {
        cl.EndUpdate();
    }
}

This page was: Helpful | Not Helpful