Chapter 20
Data page calls
Most “the data page returns nothing” problems are really “the value never arrived under the right name”. Here is every parameter and query situation, with something to try for each.
Pega 24 – 26
Words you will meet
- getData
- Parameters
- Query
Data pages
Parameters, one rule at a time.
The same decisions a real component makes are laid out as a workbench. Type what an author would type, say what the data page declares, and see exactly what would be sent, or why nothing is.
Case properties right now
- .PatientID = P-1042
- .Region = APAC
- .NotesText = Follow up in a week
- .Empty = (blank)
{ "dataViewParameters": { "Region": "APAC" }}- One parameter is declared (Region), so the value goes there.
Large data
Big lists: query, sort, paging.
When a list is too big to hold in the browser, the server does the filtering, sorting and slicing. This builds the whole request the way Pega’s own tables send it, with the reason for each part.
{ "dataViewParameters": { "Region": "APAC" }, "query": { "select": [ { "field": "Name" }, { "field": "Status" }, { "field": "Region" } ], "filter": { "logic": "T1", "filterConditions": { "T1": { "lhs": { "field": "Name" }, "comparator": "CONTAINS", "rhs": { "value": "smith" }, "ignoreCase": true } } }, "sortBy": [ { "field": "Name", "type": "ASC" } ] }, "paging": { "pageNumber": 1, "pageSize": 25 }, "includeTotalCount": true}- Pega’s data API answers “Query does not contain select” to a filter or a sort on its own, so the list of columns is always sent.
- Each filled filter becomes a numbered condition (T1, T2…), joined with AND. A filter with no value is left out.
- ignoreCase is sent for text only. Sent on a number, date or dropdown it can fail the query.
- A number filter sends a real number, so the comparison is numeric.
- Pega sorts the whole result, not just the page you see.
- With no filters there is no filter key, and a sort alone does not send an empty one.
Reference
Every call scenario.
The situations that come up again and again, each with what you type, what is sent and the trap to avoid.
You type
Parameters is blank
What is sent
{ }
The data page runs with none.
Fine for a data page with no parameters, or whose parameters are all optional. If a required one is missing, the server answers with a 400 and the console shows which.
Your turn
Questions and comments
Stuck on something, or have a thought? Write it here. To talk about one part, use the Comment button under that section's heading.