Synchronisation

Discussions about syncing data via Bluetooth, Dropbox, FTP, and using CSWeb
Post Reply
dabwil
Posts: 21
Joined: January 7th, 2021, 11:33 am

Synchronisation

Post by dabwil »

Bonjour chers tous.
j'ai conçu un masque de saisie pour collecter les données sur des salaries de différentes structures
l'année dernière nous avons déjà collecter des informations sur personnel de ces structures.
je veux que lorsque l'on lance le masque de saisie si le fichier de donnée existe de le repertoire de la tablette, que le masque de saisie ouvre ce fichier de donnée pour modification. si aucun fichier de donnée n'existe dans la tablette de le télécharger depuis le serveur CSWeb dans le repertoire et de le modifier.

cordialement.
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: Synchronisation

Post by sherrell »

It sounds like you know what datafile you want to use, you just need to find out whether you have to retrieve it from the CSWeb server first.

For this I would launch a menu application, and using your input mask, execute the FileExist function to check for the file's presence:

https://www.csprousers.org/help/CSPro/f ... ction.html

If it wasn't found, you'll have to retrieve it first from your server before you can proceed (using syncData with the GET option: https://www.csprousers.org/help/CSPro/s ... ction.html).

However, what happens if the file doesn't exist, or you don't have access to the internet or the server (it's down for maintenance, etc) in order to retrieve the file? You should include some type of recovery logic so that your application doesn't proceed using an empty file.

Sherrell
dabwil
Posts: 21
Joined: January 7th, 2021, 11:33 am

Objet : Synchronisation

Post by dabwil »

vous avez tout compris a ce que je recherche. Merci pour votre intervention je vais voir les lien que vous avez poster. cependant le 3e point celui la

<<Cependant, que se passe-t-il si le fichier n'existe pas, ou si vous n'avez pas accès à Internet ou au serveur (il est en panne pour maintenance, etc.) afin de récupérer le fichier ? Vous devez inclure un certain type de logique de récupération afin que votre application ne procède pas à l'utilisation d'un fichier vide. >> quel syntaxe utilisé ???????


cordialement
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: Synchronisation

Post by sherrell »

Well basically if it's not on the device, you'll attempt to retrieve it with syncData as I mentioned. So you'll just need to check the return code from the syncData function (was the transfer successful or not), or retest the presence of the file. If it fails, all I meant was that you probably don't want to proceed. So, just issue a message to the user telling them the file isn't there and/or couldn't be downloaded, and you're returning to the menu.

Nothing special, you just need to figure out how you want to handle this situation.

Sherrell
dabwil
Posts: 21
Joined: January 7th, 2021, 11:33 am

Re: Synchronisation

Post by dabwil »

Function lancerSaisie();
string motdepasse = prompt("Saisir mot de passe", password);
FindResult = fileexist("..\108_Data\RS.csdb");
if FindResult = 1 then
valueset string Structure_rechercheVs;

forcase SAISIE_ENSEIGNEMENT_SUPERIEUR_DICT do
string code = maketext("%v%v%v%v%v%v",ID,SAISIE_ENSEIGNEMENT_SUPERIEUR_DICT.ANNEE,A7,A8,A9,VILLAGE_SECTEUR);
endfor;

if length(Structure_rechercheVs.codes) = 0 then

if syncconnect(CSWeb, "https://stat-conseil.com/RS/api/", "user1", motdepasse)=1 then
setfile(SAISIE_ENSEIGNEMENT_SUPERIEUR_DICT, "..\108_Data\RS.csdb");
// synchroniser les données uniquement pour l'ID et l'annnée de collecte
string assignment_universe = maketext("%v%v", IDENTIFIANT, USERNAMEPASSWORD_DICT.ANNEE);
syncdata(GET, SAISIE_ENSEIGNEMENT_SUPERIEUR_DICT, assignment_universe);
syncdisconnect();
else
StartListing();
endif;

endif;
else

if syncconnect(CSWeb, "https://stat-conseil.com/RS/api/", "user1", motdepasse)=1 then
setfile(SAISIE_ENSEIGNEMENT_SUPERIEUR_DICT, "..\108_Data\RS.csdb");
// synchroniser les données uniquement pour l'ID et l'annnée de collecte
string assignment_universe = maketext("%v%v", IDENTIFIANT, USERNAMEPASSWORD_DICT.ANNEE);
syncdata(GET, SAISIE_ENSEIGNEMENT_SUPERIEUR_DICT, assignment_universe);
syncdisconnect();
else
StartListing();
endif;
endif;
end;




Voici ma fonction si le csdb n'est pas sur le serveur il lance une nouvelle saisie
Post Reply