cds_filter_fun: Conveniently include CDS Web API filter functions in...

Description Usage Arguments Value Examples

Description

CDS Web API offers a variety of filtering functions that are not standard in Odata. They are very useful when it comes to limiting the number of rows you might want to retrieve from an entity. The problem is that writing them in a query is annoying to say at least. This function will generate a string that callse the specified filter function wirhout need to encapsulate strings in ticks or remembering how arrays of values are written in odata. See list of available filter functions here: Web API Query Function Reference

Usage

1
cds_filter_fun(cds_fun_name, PropertyName = NULL, ...)

Arguments

cds_fun_name

A string representing the name of the filter function. Available functions: Web API Query Function Reference

PropertyName

Most filter functions work on at least one field from the base entity in your query. This argument allows you to specify this column as an R string. If a function does not use any fields from an entity, leave is as NULL (default value).

...

If a query function uses more arguments than just PropertyName, you can specify them here. As argument names use the same names as you can find in the documentation.

Value

A string that represents CDS Web API Odata call that can be used as argument in the Odata $filter system function. See usage examples.

Examples

1
2
3
4
5
6
7
8
9
cds_filter_fun("On", PropertyName = "createdon", PropertyValue = "2020-02-21")
cds_filter_fun("Between", "sale", PropertyValues = c(100, 300))
## Not run: 
download_cds(
  "audits",
  filter = cds_filter_fun("LastXFiscalYears", "createdon", PropertyValue = 2)
)

## End(Not run)

jarekkupisz/cdsR documentation built on Dec. 20, 2021, 9:05 p.m.