KeyView 23.3

# Metadata Examples

If you want to process both standardized and non-standardized metadata fields, you can loop through Metadata without checking is_standard() or standard_key() – both standardized and non-standardized metadata can be handled in the same way.

However, standardization allows you to handle particular metadata fields differently. Below is an illustrative example of how you might use standardized fields to act on documents.

Copy

    // Search for documents created by a certain company

    // Check for the Company standardized field
    try
    {
        auto company = document.metadata().at(MetadataKey::Company);
        if (company.convert_to_string() == "OpenText")
        {
            // Found matching standardized field
            return pathToInputFile;
        }
    }
    catch (const std::out_of_range&)
    {
        // No Company standardized field in the metadata, continue
    }

    // Check the unstandardized fields, in case the document included the
    // company name using a non-standard key
    for (auto [key, field] : document.metadata())
    {
        // Ignore standardized fields
        if (field.is_standard())
            continue;

        // Custom visitor derived from MetadataVisitorBase<bool> whose visit
        // functions all return false, except visit_target_encoding_string
        // which returns true if the string matches "OpenText"
        static CompanyIsOpenTextVisitor companyIsOpenText;
        if (field.apply_visitor(companyIsOpenText))
        {
            // Found matching non-standardized field
            return pathToInputFile;
        }
    }

Copyright 2016-2023 Open Text
Version 23.3 | Last updated June 2023

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL KeyView 23.3

Topic Title: Metadata Examples