To answer only the required prompts with the default answers when all prompts are provided with default answers, follow the following logic.
1. Instantiate a prompt object
WebPrompts prompts = theReportBean.getReportInstance().getPrompts();
theReportBean.collectData();
2. Inside a for loop that goes thrugh the WebPrompts object above, implement the following logic.
WebPrompt prompt = prompts.get(index);
if (prompt == null) return;
else {
if (!prompt.isClosed()) {
if (!prompt.isRequired()) {
//The code below tells the WebPrompts object not to answer this prompt when .answerPrompts() are called.
prompt.setClosed(false);
}
}
}
}3. Add the following line after the 'for loop' so the prompts get answered.
prompts.answerPrompts();
Customization Warning:
This customization is provided as a convenience to Strategy users and is only directly applicable to the version stated. While this code may apply to other releases directly, Strategy Technical Support makes no guarantees that the code provided will apply to any future or previous builds. In the event of a code change in future builds, Strategy Technical Support makes no guarantee that an updated version of this particular customization will be provided. For enhancements to this customization or to incorporate similar functionality into other versions, contact your Account Executive to inquire about Strategy Consulting assistance.