User and Configuration Settings

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

User and Configuration Settings

Post by khurshid.arshad »

Dear Cspro Team;

I have three tablets. In these tablets the CSPro version is 7.5.0 and Android Version is 5.1.1.

One of them is working perfectly and other two are giving an error, when i try to run my listing application on the tablet.

Error (10102)
Could no open the data source
LISTIMG_DICT_NSER: Passwords must be at least 4 characters


Application Startup Error
There was an error and CSEntry could not open /storage/enulated/0/csentry/NSER_NR/103_Application/Listing_NSER/Listing_NSER.pff


I am using "User and Configuration Settings" for Data synchronization and password for data file. The steps are as follows:

Set Password
View->User and Configuration Settings->User Settings-> Attribute ="setpassword" -> Value ="1234"-> Add

Set URl for Data Synchronization
View->User and Configuration Settings->Configuration Settings-> Attribute="cswebxyz" -> Value ="url address" -> Add -> ok

I have Three Tier application:
Login -> Menu -> Test or Listing or HH_interview application;

After successfully login the syntax in the Menu Application is as follows to run the Listing Application
PROC PROCESSING_CODE_QUEST

Preproc
datapassword=loadsetting("setpassword");
Function ListingExercise();
       
if fileexist(concat ("..\106_Ext_Data\AssignListing-", edit("9999999", Pro_Code), ".txt")) then
           
Callsysparm = sysparm(); //Callsysparm = store system parameter from login screen
           
Par_Login_ID = tonumber(sysparm()[1:5]);
            Callsysparm =
concat(Callsysparm, "-", edit("9999999", PRO_CODE), "-", T_Block_N);

            StringFileName =
Concat("Listing-", edit("9999999", PRO_CODE), "-", edit ("99999",Par_Login_ID)) ;
                    listing_pff.setproperty(
"Version", "CSPro 7.5");
                    listing_pff.setproperty(
"AppType", "Entry");
                    listing_pff.setproperty(
"StartMode", "Add");
                    listing_pff.setproperty(
"FullScreen", "Yes");
                    listing_pff.setproperty(
"Lock", "Delete");
                    listing_pff.setproperty(
"Application", "..\103_Application\Listing_NSER\Listing_NSER.ent");
                    listing_pff.setproperty(
"InputData", "..\104_Data\Listing_NSER\" + StringFileName + ".csdbe|Password=" + encode(PercentEncoding,datapassword));
//                  listing_pff.setproperty("Paradata", "..\104_Data\Listing_NSER\" + StringFileName + ".cslog");
                   
listing_pff.setproperty("Parameter", Callsysparm);
                    listing_pff.save(
"..\103_Application\Listing_NSER\Listing_NSER.pff");
                    listing_pff.exec();

       
else
            errmsg
("[...%04d...] Area for Listing is not Assigned.",Pro_Code);
               
Move to PRO_SUP_ID; //add new line
                // Move to PBN;
            //stop(1);

       
endif;
end;
I need advice.

Thanks.
a.
aaronw
Posts: 561
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: User and Configuration Settings

Post by aaronw »

Try displaying the setpassword attribute with errmsg. The attribute is included in your PEN, but it's possible you have two different PENs.

With CSPro 7.5 the csentry directory location was changed. If the installation of CSEntry was an upgrade it will be located at "/csentry." If the installation of CSEntry was new it will be installed "/Android/data/gov.census.cspro.csentry/files/csentry." Verify location of installations are the same. If not, there may be a hardcoded path. Path.concat can be helpful in creating relative paths: https://www.csprousers.org/help/CSPro/p ... ction.html
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: User and Configuration Settings

Post by khurshid.arshad »

Dear Aaronw;

I have remove the application from all the tablets and then reinstalled it.

In one of them I have removed CSPro as well and reinstall it for new location.

Now the situation is:
Two tablets have old location and one is with the new location.

I am getting the message displayed on one of them. In this tablet my application is install on the old location.
In another tablet I have old location but errmsg is blank.
In the third one the errmsg is also blank where the location is new.
PROC PROCESSING_CODE_QUEST

{THIS IS MY MENU APPLICATION}


Preproc

datapassword=loadsetting("setpassword");

errmsg ("The loadsetting password is %s", datapassword);
errmsg ("The encode password is %s", encode(PercentEncoding, datapassword));
Best regards.
a.
aaronw
Posts: 561
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: User and Configuration Settings

Post by aaronw »

Launch the application in the CSPro designer and open the User and Configuration Settings. Notice there is a dropdown menu with either user settings or configuration settings. If you added the password attribute and value to the user settings it will not be included in the PEN. Make sure configuration settings is selected. Then add the password attribute and value, publish PEN, and deploy to devices.

https://www.csprousers.org/help/CSPro/u ... tings.html
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: User and Configuration Settings

Post by khurshid.arshad »

Dear Aaronw;

Thank you, it is working now Under Configuration Settings.

Now I am trying to understand the User Settings.

View->User and Configuration Settings->User Settings-> Attribute ="UserID" -> Value = Will be Blank-> Add
View->User and Configuration Settings->User Settings-> Attribute ="EANum" -> Value = Will be Blank-> Add
View->User and Configuration Settings->User Settings-> Attribute ="BlockNo" -> Value = Will be Blank-> Add
    string loaduserid=loadsetting("UserID);

   
if loaduserid="" then
       
loaduserid = Enu_Code;//variable from my dictionary item
             
savesetting("UserID", loaduserid);
   
endif;

   
string loadeanum=loadsetting("EANum);

   
if loadeanum="" then
       
loadeanum = EA_Code;//variable from my dictionary item
             
savesetting("EANum", loadeanum);
   
endif;

   
string loadblockno=loadsetting("BlockNo);

   
if loadblockno="" then
       
loadblockno = Block_No;//variable from my dictionary item
             
savesetting("BlockNo", loadblockno);
   
endif;
Now in Listing application fill these information automatically based on the saved settings.
PROC L_Enu_Code

preproc

     
L_Enu_Code = loadsetting("loaduserid");


Please let me know.

Best regards.
a.
aaronw
Posts: 561
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: User and Configuration Settings

Post by aaronw »

I use the same general design pattern for automatic login. I'll call loadsetting and try to use the previous credentials. If it's empty the user will have to enter their credentials and they'll be saved with savesetting.
PROC M_LOGIN

preproc

    string
previousUser = loadsetting(login_setting_key);

   
if previousUser <> "" then
       
M_LOGIN = previousUser;
       
advance to M_VALIDATE_PIN;
   
endif;

postproc

    // if previousUser was empty than they'll have to enter it here and it will be saved
   
savesetting(login_setting_key, M_LOGIN);
I think you're are trying to do something a little different. Looks like you're passing information between two application. There are other ways to do this, but that doesn't mean this isn't a valid approach. Also, if the attribute does not exist, loadsetting will return the empty string. Since you're handling this case you don't have to enter the attributes through the user and configuration setting.
Post Reply