A customer is trying to make an app that will be creating graphs from Domino data very much like the "Basic CRM" app in the samples for Domino Volt. He is creating a table that holds values from the database successfully, then he is trying to use the table to count the number of "Yes" and "No" values for rows for 5 columns named "Q1", "Q2", "Q3", "Q4", "Q5".
In the javascript of the events of "Basic CRM" there's a code like this:
"BO.F_1st.setValue(app.getSharedData().countTableRowsForEntry(BO.F_OpenTable,'F_DDColmn_Open',"1"));"
He needs to understand what are the parameters there for "countTableRowsForEntry" method.
And need any documentation explaining these parameters.
He wants to know how to count all "Yes" and "No" values in a table named "F_Table1" for columns named "Q1", "Q2", "Q3", "Q4" and "Q5"
Below are two functions. The first counts the number of rows in a specific column that have a certain value. The second looks if it "includes" a value for multi select value columns
/***************************************************************************************
* This will count the number of rows that contain a specific value (entry)
* table: This is the actual table object, not the string ID (e.g. BO.F_Table)
* column: This is the string of the columnID that you want to search
* entry: this is the value of what you want to search for,
* the data type should match that of the column you are searching (i.e. string, int, date)
***************************************************************************************/
app.getSharedData().countTableRowsForEntry = function (table, column, entry) {
var entryFoundCount = 0;
for (var i = 0; i < table.getLength(); i++) {
if (get(table.get(i), column).getValue() === entry) {
entryFoundCount++;
}
}
return entryFoundCount;
}
/***************************************************************************************
- This will count the number of rows that include a specific value (entry) multientry
- table: This is the actual table object, not the string ID (e.g. BO.F_Table)
- column: This is the string of the columnID that you want to search
- entry: this is the value of what you want to search for,
the data type should match that of the column you are searching (i.e. string, int, date)
***************************************************************************************/
app.getSharedData().countTableRowsForIncludes = function (table, column, entry) {
var entryFoundCount = 0;
for (var i = 0; i < table.getLength(); i++) {
if (get(table.get(i), column).getValue().includes(entry)) {
entryFoundCount++;
}
}
return entryFoundCount;
}
Thanks a million!
Will try today.
Kind regards,
Vitalijus
Oh, the whole definition of the function was in Application onStart. And the error and problem I had was "not a function" cause I didn't copy the whole thing from "Basic CRM" Application onStart event. And I didn't see the problem cause Volt doesn't produce exceptions like IDEs do and I didn't look at browser console that was telling me the problem, cause I come from Java background and hate working with javascript with passion.
Ok, then, things were learned today, thanks again, moving on.
Kind regards, Vitalijus
Now I get: Uncaught TypeError: Cannot read property 'getValue' of undefined
at Object.app.getSharedData.countTableRowsForEntry.
And I was getting it because I was being dumb and trying to pass "Q1" and so on instead of using "F_SingleLine4" and the rest as column IDs like you told me. Now it is all good and working, thanks again. [ thumbs up ]