I want to remove file from server end after getting on tablet. Example
Code: Select all
syncfile (get, "/Map/9990001.kml","..\..\KML\");
Best regards.
a.
Code: Select all
syncfile (get, "/Map/9990001.kml","..\..\KML\");
Code: Select all
Function ReceiveMapfromServer();
if direxist("..\..\KML\") then
else
dircreate("..\..\KML\");
endif;
if fileexist("..\..\KML\"+ key (SAMPLE_DICT) [1:7]+".kml") then
errmsg ("You have already download this file.");
move to PRO_SUP_ID;
elseif syncconnect(CSWeb, "http://203.82.55.214/csweb75/api") = 1 then
//First check if there is Dactivation informaation against this EA
syncfile (get, "/Maptxt/"+ "Dact-"+key (SAMPLE_DICT) [1:7]+".txt","..\..\KML\");//First check Dactivated EA
if fileexist("..\..\KML\"+"Dact-"+key (SAMPLE_DICT) [1:7]+".txt") then
setfile (FileKMLTxt, "..\..\KML\"+"Dact-"+key (SAMPLE_DICT) [1:7]+".txt");
while fileread (FileKMLTxt, PreLoad_Data) do;
string ActiveDactive =PreLoad_Data[33:11];
enddo;
else
//If deactive file does not exist on the server
syncfile (get, "/Maptxt/"+ key (SAMPLE_DICT) [1:7]+".txt","..\..\KML\");
//If file receive from the server
if fileexist("..\..\KML\"+key (SAMPLE_DICT) [1:7]+".txt") then
//If EA already get someone else
message1="سلیکٹ کیے گے اینومریشن ایریا نمبر ";
message2="میں آپ کام نہیں کر سکتے";
set errmsg (operator);
errmsg ("%s\n\n%s\n\n%s", message1,key (SAMPLE_DICT) [1:7],message2);
set errmsg (default);
syncdisconnect();
filedelete("..\..\KML\"+key (SAMPLE_DICT) [1:7]+".txt");
move to PRO_SUP_ID;
else
syncfile (get, "/Map/"+ key (SAMPLE_DICT) [1:7]+".kml","..\..\KML\");
if fileexist("..\..\KML\"+key (SAMPLE_DICT) [1:7]+".kml")=0 then
//If map does not exist on the server
message1="سلیکٹ کیے گے اینومریشن ایریا نمبر ";
message2="کا نقشہ ابھی موجود نہیں ہے۔ ";
message3= "اس اینومریشن ایریا کا نقشہ آپ کو بعد میں دیا جاے گا";
set errmsg (operator);
errmsg ("%s\n\n[%04s]\n\n%s\n\n%s.", message1, key (SAMPLE_DICT) [1:7],message2,message3);
set errmsg (default);
move to PRO_SUP_ID;
else
//Write text file
setfile (FileKMLTxt, "..\..\KML\"+key (SAMPLE_DICT) [1:7]+".txt",create);
filewrite(FileKMLTxt, key (SAMPLE_DICT) [1:7]+"-"+sysparm()[1:5]);
close(FileKMLTxt);
syncfile (PUT,"..\..\KML\"+key (SAMPLE_DICT) [1:7]+".txt", "/Maptxt/");
syncdisconnect();
syncfile (get, "/Map/"+ key (SAMPLE_DICT) [1:7]+".kml","..\..\KML\");
errmsg ("Map for EA No. [%04s] has been downloaded.", key (SAMPLE_DICT) [1:7]);
move to PRO_SUP_ID;
endif;
endif
endif;
else
//if internet not working
message1="آپ یہ ایکٹیوٹی اس ٹیبلیٹ پر نہیں کر سکتے کیوں کہ آپ کے ٹیبلیٹ پر اس وقت ";
message2="انٹرنیٹ ";
message3="موجود نہیں ہے۔";
set errmsg (operator);
if errmsg(1, message1,message2,message3) then
set errmsg (default);
move to Pro_Sup_ID;
else
move to Pro_Sup_ID;
endif;
endif;
end;
Function DeclineEA()
if fileexist("..\..\KML\"+key (SAMPLE_DICT) [1:7]+".kml") then
//If decline the EA
message1="Decline Enumeration Area:";
message2="کا مطلب ہے";
message3="کہ آپ اس ایریا نمبر ";
message4="کا تقشہ سرور سے ڈوان لوڈ کر چکے ہیں";
message5="اور اب اس میں کام نہیں کرنا چاہتے اور نہ ہی آپ نے اس ایریا میں کام شروع کیا۔ تو اس صورت میں اس ایریا کا نقشہ آپ کے ٹیبلیٹ سے ختم ہو جاے گا۔";
set errmsg (operator);
errmsg ("%s\n%s\n\n%s\n\n%s\n\n%s\n\n%s", message1,message2,message3,key (SAMPLE_DICT) [1:7], message4, message5);
set errmsg (default);
Index=accept ("Decline Enumeration Area",
"نہیں، غلط آپشن کا انتخاب ہو گیا ہے",
" ",
"کیا آپ اس ایریا کا نقشہ دیکلاین کرنا چاہتے ہیں");
if index =1 then
move to Pro_sup_ID;
elseif index =2 then
errmsg("You did not select any option.");
move to Pro_sup_ID;
elseif index=3 then
if syncconnect(CSWeb, "http://203.82.55.214/csweb75/api") = 0 then
message1="آپ یہ ایکٹیوٹی اس ٹیبلیٹ پر نہیں کر سکتے کیوں کہ آپ کے ٹیبلیٹ پر اس وقت ";
message2="انٹرنیٹ ";
message3="موجود نہیں ہے۔";
set errmsg (operator);
if errmsg(1, message1,message2,message3) then
set errmsg (default);
move to Pro_Sup_ID;
else
move to Pro_Sup_ID;
endif;
else
setfile (FileKMLTxt, "..\..\KML\"+"Dact-"+key (SAMPLE_DICT) [1:7]+".txt",create);
filewrite(FileKMLTxt, "Dact-"+key (SAMPLE_DICT) [1:7]+"-"+sysparm()[1:5]+ " File has been Deactivated");
close(FileKMLTxt);
syncfile (PUT,"..\..\KML\"+"Dact-"+key (SAMPLE_DICT) [1:7]+".txt", "/Maptxt/");
syncdisconnect();
filedelete("..\..\KML\"+ key (SAMPLE_DICT) [1:7]+".KML");
filedelete("..\..\KML\"+ key (SAMPLE_DICT) [1:7]+".txt");
filedelete("..\..\KML\"+ "Dact-"+key (SAMPLE_DICT) [1:7]+".txt");
set errmsg (operator);
errmsg ("The Enumeration Area No\n\n..%s..\n\nhas been Deactivated.", key (SAMPLE_DICT) [1:7]);
set errmsg (default);
move to Pro_sup_ID;
endif;
endif
else
set errmsg (operator);
errmsg ("You don't have Enumeration Area No\n\n..%s..\n\nfor Deactivation.", key (SAMPLE_DICT) [1:7]);
set errmsg (default);
Move to Pro_Sup_ID;
endif;
end;