Skip to content

RecordCursor

This module provide functions to work with Record Cursor.

The user or API Token must have permission to view the records.

Constructor

Parameter

Name Type Required Description
connection Connection yes The connection module of this SDK.

Sample code

Init app module Source code

    // Init authentication
    Auth kintoneAuth = new Auth()

    // Password Authentication
    String username = "your_username"
    String password = "your_password"
    kintoneAuth = kintoneAuth.setPasswordAuth(username, password)
    Connection connection = Connection( "your_domain", kintoneAuth )
    RecordCursor recordCursor = new RecordCursor(connection);

Methods

createCursor(Integer app, Array<String> fields, String query, Integer size)

Create a cursor.

Parameter

Name Type Required Description
appId Integer yes The kintone app ID
fields Array<String> (optional) Fields of record to return
query String (optional) Query condition
size Integer (optional) Number of records to retrieve per request.
Default: 100.
Maximum: 500.

Return

CreateRecordCursorResponse

Sample code

create Cursor Source code

    RecordCursor recordCursor = new RecordCursor(connection);

    int appID = 110;
    int size = 500;
    String query = "order by 数値 desc";
    ArrayList fields = new ArrayList();
    fields.add("数値");

    CreateRecordCursorResponse cursor = recordCursor.createCursor(appID, fields, query, size);
    System.out.println("cursorID: " + cursor.getId());
    System.out.println("totalRecord: " + cursor.getTotalCount());

    /*
    output:
    cursorID: "your_cursor_id"
    totalRecord: 50
    */

getRecords(String cursorID)

Get one block of records.

Parameter

Name Type Required Description
cursorID String (optional) The cursor ID.

Return

GetRecordCursorResponse

Sample code

Get Records Source code
    RecordCursor recordCursor = new RecordCursor(connection);

    String cursorId = "dc24fc1f-4195-41b3-a55d-7e4547d45de1";
    GetRecordCursorResponse response = recordCursor.getRecords(cursorId);

    ArrayList> resultRecords = response.getRecords();
    for (HashMap record : resultRecords) {
        for (Entry entry : record.entrySet()) {
            System.out.println(entry.getKey() + " " + entry.getValue().getValue());
        }
    }
    /*
    output:
    数値 7669
    数値 7668
    数値 7667
    数値 7666
    数値 7665
    */

getAllRecords(String cursorID)

Get all records

Parameter

Name Type Required Description
cursorID String yes The cursor ID.

Return

GetRecordsResponse

Sample code

get Apps By IDs Source code
    RecordCursor recordCursor = new RecordCursor(connection);

    String cursorId = "dc24fc1f-4195-41b3-a55d-7e4547d45de1";
    GetRecordsResponse response = recordCursor.getAllRecords(cursorId);

    ArrayList> resultRecords = response.getRecords();
    for (HashMap record : resultRecords) {
        for (Entry entry : record.entrySet()) {
            System.out.println(entry.getKey() + " " + entry.getValue().getValue());
        }
    }

    /*
    output:
    数値 7669
    数値 7668
    数値 7667
    数値 7666
    数値 7665
    */

deleteCursor(String cursorID)

Delete a cursor

Parameter

Name Type Required Description
cursorID String yes The cursor ID.

Return

none

Sample code

Delete Cursor Source code
    RecordCursor recordCursor = new RecordCursor(connection);

    String cursorId = "dc24fc1f-4195-41b3-a55d-7e4547d45de1";
    recordCursor.deleteCursor(cursorId);