I use globals.svy_nav_getAllVisibleFormNames() to get all visible form names. In the next step, I need the program of all visible forms. In the case the form is not yet shown, I don’t get the program with getProgram.This is in the case, if the form / program tab is not yet clicked, so that the form / program was not yet shown.
How can I get the program for a form, that was not yet shown?
/**
* Get the program name for a form.
*
* @param {String} formName , the form name for which the program name is required.
* @return {String} the program name if there a program for the form otherise "null" is returned.
*
* @public
* @since 18.11.2013
*
* @author deezzub
*/
function getProgramName( formName ) {
var /** @type {JSFoundSet<db:/svy_framework/nav_program>} */
programFs,
programName = null,
/** @type {JSRecord<db:/svy_framework/nav_program>} */
programRec,
/** @type {QBSelect<db:/svy_framework/nav_program>} */
programQuery,
/** @type {String} */
baseFormName = null;
if ( formName.match( '_dtl' ) ) {
baseFormName = formName.replace( '_dtl' , '' );
} else if ( formName.match( '_tbl' ) ) {
baseFormName = formName.replace( '_tbl' , '' );
}
if ( baseFormName ) {
programQuery = databaseManager.createSelect('db:/svy_framework/nav_program');
programQuery.where.add( programQuery.columns.base_form_name.eq( baseFormName ) );
programFs = databaseManager.getFoundSet( programQuery );
programRec = programFs.getRecord( 1 ); // TODO return array if there are more than one program
programName = programRec.program_name;
}
return programName;
}