Putting an expiry date to the Data entry Application

Discussions about CSEntry
Post Reply
sham
Posts: 53
Joined: February 3rd, 2022, 7:30 pm

Putting an expiry date to the Data entry Application

Post by sham »

Dear all,
I have designed a Csentry application for data collection that I want the enumerators to use just 10 days to finish collecting t and submitting the data.
Now the challenge is that, these guys are using their own android phone to do this exercise, so is there any logic that I can implement in the application not to allow data entry after 10days. Just to avoid any "extreme" or unwanted submissions to my dropbox account

lets say; Data collection period: 11/05/2022 to 21/05/2022
So any body trying to use the app to collect data after 21/05/2022 CAPI should crash!

If is it is also possible to add an errmsg("Data collection app is expired contact the programmer");


Thank you always for your guide.

Sham.
htuser
Posts: 600
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Putting an expiry date to the Data entry Application

Post by htuser »

Hi Sham,
You can explore several ways:
a) Change the password of your Dropbox account once the fieldwork is over; (It's the simplest way)

b) Using The publishdate function for your deployed app and based on device date (using CSPro sysdate function) disable the app after a specified number of days. You'll have to think about enumerators changing time/date of theirs devices. However, you can implement some workarounds in logic to identify if there's a date change on device and disable the app;

I don't know if there's a way to gather time from CSWeb, FTP or Dropbox servers with CSPro on synconnect. If this is possible, it would be easy to detect time change on device and disable CSEntry apps on device time change. CSPro, have a synctime function, but i don't know if it take the time from the device or from servers...

c) A way that i implemented, but more complicated, use unique ID for device management. So, i can disable access to any device. It's based on lot of functions using device username, registered email, MAC Adress and Android ID... It's my dream to share ready to use packages for CSProusers on the forum when CSPro Logic can support it... So, others users and i will be able to facilitate lot of things for users like you.

Hope this help.
Last edited by htuser on May 12th, 2022, 2:29 pm, edited 4 times in total.
G.VOLNY, a CSProuser from Haiti, since 2004
htuser
Posts: 600
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Putting an expiry date to the Data entry Application

Post by htuser »

Thanks again to the CSPro Developer Team for the support of Javascript in CSPro.
@Sham, for the already posted b) , you can use lot of JS libs for having a server time and detect if there's a time change on device.
https://github.com/NodeGuy/server-date
https://www.nodeguy.com/serverdate/
or https://www.codeproject.com/Articles/79 ... JavaScript

Hope this help you,
G.VOLNY, a CSProuser from Haiti, since 2004
sham
Posts: 53
Joined: February 3rd, 2022, 7:30 pm

Re: Putting an expiry date to the Data entry Application

Post by sham »

Hi htuser,
Very proud of you and the team for your swift response.
I think I will rather go for option a.(simple) which will work perfectly for me.

I would have prefer option(b) as the number 2 option using the link https://github.com/NodeGuy/server-date because with that one, if I get your explanation right, they will not be able to use the app again on the device as well. But the challenge is that where do I place the logic in the dropbox account and how? because when I open the link, I saw some logic at the button which I find it difficult to relate. If you can break them further sir?

Many thanks to you @htuser.

Sham
htuser
Posts: 600
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Putting an expiry date to the Data entry Application

Post by htuser »

1.- For gather time from a server:
a.- You'll have to download the JS libs*, put it on your CSEntry App folder and reference his path in CSPro logic.
For help, please read support provided by Alex months ago, in this post: viewtopic.php?f=1&t=4780
b.-You'll have to read this post viewtopic.php?f=1&t=4763 to find a workaround to transfer results from the Webview part of CSEntry to CSPro logic during runtime. So, you'll be able to transfer the Server time from JS to CSPro Logic;

It's possible to use the htmlDialog function https://www.csprousers.org/help/CSPro/h ... ction.html for this task. But, this will open a new page. Explanations of b) offer a more direct way.

2.- Rather than diagnosis/release date, you'll have to use two ways:
a) The publishdate function to have the date and time of the compilation your CSEntry https://www.csprousers.org/help/CSPro/p ... ction.html and follow the provided example to stop the app https://www.csprousers.org/help/CSPro/s ... s%20to%200 using
stop(1);
b) Using the datediff function between the actual date: sysdate
https://www.csprousers.org/help/CSPro/s ... ction.html
and the server date transfered from JS to CSPro.
something like:
numeric date1=int(publishdate() / 1000000); // ignore the time, so in ("YYYYMMDD") format;
numeric data2=serverTime; //from JS
numeric numberOfDay= datediff(date1, date2,"d")
if numberOfDay>10 then
errmsg
("You're not authorized to use this app");
stop(1);
end;
Please note, all logic must be written in the preproc of your CSPro App (the first level proc or in the menu if you use one), not in Dropbox.

Dropbox have a Javascript API (https://dropbox.github.io/dropbox-sdk-js/) that can be used in CSPro, but, i don't see where it allow to get time from his servers.
If you decide to write some codes, i can help you. Please start posting some logics in a demo app on the forum, i'll be able to provide you more help.

Best Regards,
* Using JS, there's lot of way to get time from a server, please read:
https://stackoverflow.com/questions/612 ... re-users-c
https://stackoverflow.com/questions/202 ... -web-pages
https://stackoverflow.com/questions/431 ... erver-time
etc... https://www.google.com/search?q=time+fr ... e&ie=UTF-8
G.VOLNY, a CSProuser from Haiti, since 2004
sham
Posts: 53
Joined: February 3rd, 2022, 7:30 pm

Re: Putting an expiry date to the Data entry Application

Post by sham »

At@htuser... am most grateful for your support.
Will explore all techniques...

Sham.
Post Reply