Dear Manish,
I want to create such an application which loads or open only the desired case or cases based on case id provided in identification menu rather than loading all the cases exist in data file.
I already doing something similar. Here's the way that i followed.
a) I'm using a menu to manage this;
b) I'm writing a PFF using pff object with followings specifications
b.1.- I'm using sql query to select cases that i want to display;
b.2.- I fill a list with the result of the sqlquery and using list.show for giving a way for end user to choose the exact questionnaire to open;
b.3.- I store this result of the choice in a specific variable who'll be used for the pff, for example, i named it questKey and i used it with
with pff properties CaseListingFilter and StartMode.
IpbPff_modify.setproperty ("ShowInApplicationListing","Never");
.setproperty ("CaseListingFilter",maketext("%s",questKey));
.setproperty ("StartMode",maketext("Modify;%v",questKey));
Here's an example of logic for this task. I'm upgrading and cleaning it using latest features. But it worked.
I used the same logic for add,verify and modify.
function EntryPffIpb_modification(function controller(string))
pff IpbPff_modify;
string usern;
list string listeMenage;
list string listeKeys;
{if not setfile(outputFile,strip(pffFilenameIpb),create) then
errmsg(101);
endif;}
if getos()>0 then
if getos() <=20 then
codetablet=getdeviceid();
endif;
if getos()=30 then
string codeTabletUwp= getdeviceid();
codetablet=codeTabletUwp[2:36];
endif;
numeric i=tblrow(CodeNomMachine);
numeric j= tblcol(CodeNomMachine);
do numeric ctr = 1 while ctr <= i
string codeMachine =CodeNomMachine(ctr,1);
if codeMachine=getdeviceid()
then
//Errmsg ("Le code %v est trouve",codeOp);
nomtablet=CodeNomMachine(ctr,2);
endif;
enddo;
usern = nomtablet;
endif;
string nomCsdb=strip(usern)+".csdb";
string cheminCsdb=maketext (pathname(Application) + "Applications\IPB_V1"+"\Data\"+nomCsdb);
//Errmsg ("Le chemin du ficher est %v",cheminCsdb);
if fileexist(cheminCsdb) then
if filesize(cheminCsdb) > 0
then
string listeMenage_query_formatter=maketext("SELECT cases.label FROM 'level-1' JOIN cases ON cases.id = `level-1`.`case-id` WHERE cases.deleted = 0 and `level-1`.codevicq = %v;",numVicq());//and cases.label<>''
//Errmsg ("la requete label est %v",listeMenage_query_formatter);
sqlquery(cheminCsdb,listeMenage,listeMenage_query_formatter);
string listeCleMenage_query_formatter=maketext("SELECT cases.key FROM 'level-1' JOIN cases ON cases.id = `level-1`.`case-id` WHERE cases.deleted = 0 and `level-1`.codevicq = %v;",numVicq());//and cases.label<>''
//Errmsg ("la requete cle est %v",listeCleMenage_query_formatter);
sqlquery (cheminCsdb,listekeys,listeCleMenage_query_formatter);
numeric tailleListeMenage = listeMenage.length();
string cleQuestionnaire;
if tailleListeMenage>0 then
numeric idQuestionnaireIndex=listeMenage.show (tr (1124));
cleQuestionnaire=listekeys(idQuestionnaireIndex);
else
Errmsg ("Vous n'avez aucune liste de menages a modifier!");
controller("F");
endif;
//Errmsg ("le cle du questionnaire est %v",cleQuestionnaire);
//Errmsg ("La version est%10.2f",tonumber (strip (diagnostics("version"))));
#if exists(MENU_GV_DICT)
IpbPff_modify.load("IPB_mV1.pff");
string univers=edit("99",numVicq());
IpbPff_modify.setproperty ("Description","Formulaire Electronique IPB");
IpbPff_modify.setproperty ("ShowInApplicationListing","Never");
IpbPff_modify.setproperty ("CaseListingFilter",maketext("%s",cleQuestionnaire));
IpbPff_modify.setproperty ("OperatorID",maketext("%v",strip(MENU_GV_DICT.CODE_UTILISATEUR)));
//IpbPff_modify.setproperty ("Key",maketext("%v",strip(cleQuestionnaire)));
IpbPff_modify.setproperty ("StartMode",maketext("Modify;%v",cleQuestionnaire));
IpbPff_modify.setproperty ("AutoAdd","No");
IpbPff_modify.setproperty ("Lock","Add,Verify");
IpbPff_modify.setproperty ("NoFileOpen","Yes");
IpbPff_modify.setproperty ("Application",maketext("%v",strip(applicationName)));
IpbPff_modify.setproperty ("InputData",maketext("%v",concat(strip(dataFolder),strip(usern),".csdb")));
IpbPff_modify.setproperty ("Paradata",maketext("%v",concat(strip(dataFolder),strip(usern),".cslog")));
IpbPff_modify.setproperty ("CommonStore",maketext("%v",concat(strip(RessourcesFolder),strip(usern),".db")));
{EnqLegerePff_add.setproperty ("[ExternalFiles]");}
IpbPff_modify.setproperty ("RAPPORT_EXT_DICT",maketext("%v",concat(strip(dataFolder),strip(usern),"_ext",".csdb")));
{EnqLegerePff_add.setproperty ("[Parameters]");}
IpbPff_modify.setproperty ("OnExit","IPB_m2V1.pff");
IpbPff_modify.exec();
#endif;
endif;
endif;
end;
Note that, this display a group of questionnaire based on some criteria and give the end user a way to open exactly the questionnaire he want to open: verify or modify. But, using the same thinking, there's a way to give end user a screen where to manually write a questionnaire key or ID Items and open it. The latest is more simple since it not require using sqlquery.
Hope this help you!