I am generating a plugin for implementing a web service that displays all the data rows for a particular application in a database. I have a query regarding how to get table data in to a formrowset

Confluence User - 06 Jul, 2017

using formdatadao.load we can extract a specific row based on primary key but I want to extract all the data rows into a formrowset regardless of any condition or primary key and read from there later... Please do help..

forms;plugins;database

2


06 Jul, 2017
confluenceUser
confluenceUser

You can use formdatadao.find and pass in no condition. It should return all and you can play with the rest of the parameters for paging purpose.

07 Jul, 2017
confluenceUser
confluenceUser

check here FormDataDao#find

 

    /**
     * 
     * @param condition
     * @param formDef
     * @param params
     * @param start
     * @param rowCount
     * 
     * @return FormRowSet
     * 
     * @throws Exception 
     */
    public FormRowSet findRecords(String condition, FormDefinition formDef, ArrayList params, Integer start, Integer rowCount) throws Exception {
        LogUtil.info(TAG, ">>>>>>> extra conditions : " + condition);
        LogUtil.info(TAG, ">>>>>>> Row Limits :  Start= " + start + ", Count= " + rowCount);
        FormRowSet rowSet = null;
        if (params.isEmpty() && (rowCount == null || rowCount == 0)) {
            throw new Exception("if parameters are empty, `rows` must be specifed");
        }
        try {
            FormDataDao formDataDao = (FormDataDao) AppUtil.getApplicationContext().getBean("formDataDao");
            rowSet = formDataDao.find(formDef.getName(), formDef.getTableName(), condition, params.toArray(), null, null, start, rowCount);
        } catch (Exception ex) {
            LogUtil.error(TAG, ex, ex.getMessage());
            throw ex;
        }
        FormRowSet records = new FormRowSet();
        for (FormRow formRow : rowSet) {
            String latestProcessId = null;
            try {
                latestProcessId = getLatestProcessId(formRow.getId());
            } catch (Exception e) {
                LogUtil.error(TAG, e, e.getMessage());
            }
            LogUtil.info(TAG, ">>>>>>> latestProcessId: " + latestProcessId);
            formRow.put("latest_processId", latestProcessId);
            records.add(formRow);
        }
        return records;
    }
RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print