Skip to content
CCPEDIAby Unity Nodes
App Development

Filtering entities from the ledger

2 posts56 viewsLast activity Jun 2026

  1. Justin_AtwellOP

    I’m trying to filter entities on the ledger side prior to returning the records.

    Is there any way to filter entities being returned on the ledger directly? This is what I have below for EventFormat, but I’d like to filter deeper on types or individual parties

    private EventFormat buildEventFormat(String partyId) {
            return new EventFormat(
                    Map.of(
                            partyId,
                            new CumulativeFilter(
                                    Map.of(),
                                    Map.of(),
                                    Optional.of(Filter.Wildcard.HIDE_CREATED_EVENT_BLOB)
                            )
                    ),
                    Optional.empty(),
                    true
            );
        }
    
  2. Jatin_Pandya_cf

    Hey @Justin_Atwell

    try to replace the wildcard filter with explicit template or interface filters also for heavier query patterns e.g. filtering by field values, complex predicates etc…the Ledger API doesn’t support predicate pushdown so you’d need PQS for that, which lets you run SQL directly against the ACS.

    Map.of(
          partyId,
            new CumulativeFilter(
                    Map.of(
           "your-package-id", Map.of(
                   new Identifier("your-package-id", "YourModule", "YourTemplate"),
            new TemplateFilter(Optional.empty(), false) 
                        )
                    ),
                    Map.of(),
                    Optional.empty()
                )
            ),
            Optional.empty(),
            true
        );