Data API
Read Operations
Reading from Views

Reading from Views

Views in DealCloud are preconfigured data filters. Reading from views is often more efficient than reading from objects with manual filtering. HTTP uses intapp-rest-client; tune pageSize and concurrency via Advanced configuration.

Basic View Read

from dealcloud_sdk import DealCloud, DealCloudConfig
 
config = DealCloudConfig(
    siteUrl="yoursite.dealcloud.com",
    clientId=12345,
    clientSecret="your-secret",
)
dc = DealCloud.from_config_object(config)
 
# Read from view by name
data = dc.read_data(view_id="My Company View", output="pandas")
 
# Read from view by ID
data = dc.read_data(view_id=12345, output="pandas")
💡

Views apply filters, sorting, and field selections configured in DealCloud. This reduces data transfer compared to reading full objects.

Listing Available Views

# Get all views
views = dc.list_configured_views()
 
for view in views:
    print(f"{view.id}: {view.name} ({view.entryListName})")
 
# Get only private views (including shared with you)
private_views = dc.list_configured_views(is_private=True)

View Properties

PropertyTypeDescription
idintView ID
namestrView display name
entryListIdintParent object ID
entryListNamestrParent object name
isPrivateboolIs private view
createdBydictView creator

Resolving view metadata

Use resolve_view to map a view ID or exact name to metadata from list_configured_views — without reading view record data. Use resolve_view_display_name when you only need the label for logging or UI.

# By ID or name → metadata row (id, name, primaryLists, entryListName, ...)
view = dc.resolve_view(58954)
view = dc.resolve_view("My Company View")
primary_object = view["primaryLists"][0]["name"]
 
# Display name only
label = dc.resolve_view_display_name(58954)  # "My Company View"
MethodInputReturns
resolve_view(view)int or str (exact name)dict — view metadata row
resolve_view_display_name(view)int or strstr — name, or str(id) if name missing

Raises ValueError if the view is not found or multiple views share the same name.

Supply Value Later Filters

Views can have "Supply Value Later" filters that require values at read time:

# View has a "CompanyType" filter configured as "Supply Value Later"
data = dc.read_data(
    view_id="Filtered Companies",
    output="pandas",
    view_filter=[
        {
            "column": "CompanyType",
            "value": [12345]  # Choice value ID
        }
    ]
)

Multiple Filters

# Supply multiple filter values
data = dc.read_data(
    view_id="Deal Pipeline",
    output="pandas",
    view_filter=[
        {
            "column": "Stage",
            "value": [101, 102, 103]  # Multiple stage IDs
        },
        {
            "column": "AssignedTo",
            "value": [5678]  # User ID
        }
    ]
)

Filter Value Types

Field TypeValue FormatExample
ChoiceList of choice IDs[12345, 12346]
ReferenceList of entry IDs[100, 200, 300]
UserList of user IDs[1, 2, 3]
TextString"search term"
NumberNumber1000000
DateISO date string"2024-01-01"

View vs Object Comparison

# Read from view - filters applied server-side
active_companies = dc.read_data(
    view_id="Active Companies",
    output="pandas"
)
# Only returns companies matching view's filter criteria
# Faster, less data transferred

Views with Additional Filters

You can combine view filters with additional query:

# View "Active Companies" + additional filtering
recent_active = dc.read_data(
    view_id="Active Companies",
    output="pandas",
    query="{CreatedDate: {$gte: '2024-01-01'}}"
)

Specifying Fields

Override view's default fields:

# Only get specific fields, ignoring view's field selection
data = dc.read_data(
    view_id="Company Summary",
    output="pandas",
    fields=["CompanyName", "Revenue"]  # Only these fields
)

Example: View Workflow

from dealcloud_sdk import DealCloud, DealCloudConfig
 
config = DealCloudConfig(
    siteUrl="yoursite.dealcloud.com",
    clientId=12345,
    clientSecret="your-secret",
)
dc = DealCloud.from_config_object(config)
 
# 1. Find the view you need
views = dc.list_configured_views()
pipeline_views = [v for v in views if "pipeline" in v.name.lower()]
 
for v in pipeline_views:
    print(f"{v.id}: {v.name}")
 
# 2. Read from view with filter
deals = dc.read_data(
    view_id="Deal Pipeline - Active",
    output="pandas",
    view_filter=[
        {
            "column": "Stage",
            "value": [101, 102]  # Prospecting and Qualification stages
        }
    ]
)
 
# 3. Process results
print(f"Found {len(deals)} deals in early stages")
print(f"Total value: ${deals['DealValue'].sum():,.0f}")

include_nulls Parameter with Views

When reading from views, the include_nulls parameter is automatically set to False, regardless of what you specify.

⚠️

Important: The include_nulls parameter is ignored for views. It is always set to False because:

  • Views have no column metadata API (no way to know which columns are configured)
  • When include_nulls=True, the API returns all possible fields from underlying objects
  • This results in hundreds or thousands of columns instead of the expected configured columns

Why include_nulls=False for Views?

Views can contain data from multiple object types, and there's currently no API endpoint to query which columns are configured in a view. When include_nulls=True is used:

  • The API returns all possible fields from all underlying objects
  • This can result in 1000+ columns instead of the expected 10-20 configured columns
  • Affects all output formats (pandas, polars, list)

By automatically setting include_nulls=False:

  • The API only returns fields that are actually present in the data
  • Column counts match the expected view configuration
  • Works consistently for all output formats

Example:

# Even if you pass include_nulls=True, it's forced to False for views
df = dc.read_data(view_id="My View", output="pandas", include_nulls=True)
# Result: Only columns with actual data (not all possible fields)

Performance Considerations

  1. Use views for recurring reports - Filter logic is saved and optimized
  2. Prefer views over object+query - Server-side filtering is faster
  3. Create views for common filters - Reduces query complexity in code
  4. Use "Supply Value Later" - For dynamic filters with fixed structure

Streaming from Views

For large views, use streaming:

# Stream view data for memory efficiency
for row in dc.read_data_streaming(view_id="Large Report View"):
    process(row)

Related