You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
smth = DATA INTEGER (Item);
first = DATA INTEGER (Category);
firstSmth(Category ct) = GROUP SUM smth(Item i) IF level(category(i), ct) ORDER DESC smth(i) TOP first(ct);
EXTEND FORM items
PROPERTIES (c) first, firstSmth
PROPERTIES (i) smth
;
Limiting some objects
Example for PARTITION (in MyCompany, using the upper example)
firstSmth(Item i, Category ct) = PARTITION LAST smth(i) IF level(category(i), ct) ORDER DESC smth(i) BY ct TOP first(ct) OFFSET 3;
EXTEND FORM items
PROPERTIES firstSmth(i, c)
OBJECTS ti = Item
PROPERTIES name(ti), firstSmth(ti, c), smth(ti)
FILTERS level(category(ti), c), firstSmth(ti, c)
;
Batching
Example for FOR (in MyCompany)
FOR iterate(INTEGER j, 0, [GROUP SUM 1 IF Item i IS Item]() / 50) DO
NEWSESSION NEWSQL NEWTHREAD {
sleep(15000);
APPLY FOR Item i IS Item ORDER i TOP 50 OFFSET j * 50 DO
smth(i) <- smth(i) + 1;
}
Paging (for example in API)
Example for JSON (in myCompany)
getItems(STRING nameFilter, INTEGER page, INTEGER pageSize) {
exportJSON() <- JSON FROM name(Item i) WHERE name(i) LIKE '%'+nameFilter+'%' ORDER name(i) TOP pageSize OFFSET (page - 1) * pageSize;
}
AlexKirkouski
changed the title
Support TOP (OFFSET) in GROUP / JSON operators
Support TOP (OFFSET) in GROUP / JSON / PARTITION / FOR operators
Dec 2, 2024
Example for GROUP (in MyCompany) :
Limiting some objects
Example for PARTITION (in MyCompany, using the upper example)
Batching
Example for FOR (in MyCompany)
Paging (for example in API)
Example for JSON (in myCompany)
Query: http://127.0.0.1:7651/exec/getItems?nameFilter=A&page=2&pageSize=50
The text was updated successfully, but these errors were encountered: