Eplan Platform API
EPLAN API / User Guide / API MasterData / Filtering parts database items
In This Topic
    Filtering parts database items
    In This Topic

    Example for filtering parts database using MDObjectFilter() class:

    using (MDPartsDatabase partsDatabase = new MDPartsManagement().OpenDatabase())
    {
        //Get all parts which part number starts on "SIE"
        MDObjectFilter mDObjectFilter = new MDObjectFilter();           
        mDObjectFilter.AddPropertyCondition(22001, MDObjectFilter.CompareOperator.OperatorEqual, "SIE*"); //22001 - enum Properties.MDPartsDatabaseItem
        MDPart[] arrParts = partsDatabase.GetParts(mDObjectFilter);       
        partsDatabase.ExportParts("C:\\exportDirectory\\exportFile.xml", MDPartsDatabase.DataFormat.XML, arrParts);
    }
    

     

    Filtering parts database using Linq query :

    using (MDPartsDatabase partsDatabase = new MDPartsManagement().OpenDatabase())
    {
        //Export only parts modified today
        var today = DateTime.Today;
        var partsModifiedToday = partsDatabase.Parts.Where(item => item.Properties.PART_LASTCHANGE_DATE.ToTime() > today);
        partsDatabase.ExportPartsDatabaseItems("C:\\exportDirectory\\exportFile.xml", MDPartsDatabase.DataFormat.XML, partsModifiedToday);
    }