Dear Josh,
Sorry to come back to you on this, I can't still get the desired result. I have updated the logic in PROC POLE_GPS_TAKE as follows. The application is still not saving the acquired gps coordinates to be used for another household on the same pole.
PROC POLE_GPS_TAKEN
preproc
if loadsetting("POLE_LATITUDE") <> "" then
POLE_LATITUDE = tonumber(loadsetting("POLE_LATITUDE"));
endif;
if loadsetting("POLE_LONGITUDE") <> "" then
POLE_LONGITUDE = tonumber(loadsetting("POLE_LONGITUDE"));
endif;
onfocus
if visualvalue(POLE_LATITUDE) = 99 or visualvalue(POLE_LATITUDE) = notappl then
setvalueset($, GPS_NOT_TAKEN_VS2);
else
setvalueset($, GPS_TAKEN_VS1);
endif;
postproc
if $ = 1 then
// Take new GPS reading
gps(open);
if gps(read,60,10,"Reading GPS, Please wait...") = 1
and accept(maketext("Save this location? %f, %f",gps(latitude),gps(longitude)),"Yes","No") = 1 then
{if accept("Save this result", "Yes", "No") = 1 then}
POLE_LATITUDE = gps(latitude);
savesetting("POLE_LATITUDE", "");
POLE_LONGITUDE = gps(longitude);
savesetting("POLE_LONGITUDE", "");
ADVANCE TO COMPOUND_NUMBER;
else
errmsg("GPS signal could not be acquired");
endif;
gps(close);
//reenter;
elseif $ = 2 then
// Show current readings on map
//execsystem(maketext("gps:%f,%f",
// visualvalue(LI_LATITUDE),
// visualvalue(LI_LONGITUDE)));
// reenter;
elseif $ = 3 then
// Keep the readings and move to next field
advance to COMPOUND_NUMBER;
elseif $ = 9 then
// Remove current readings
POLE_LATITUDE = 99.000000000;
POLE_LONGITUDE = 99.000000000;
endif;
Saved GPS reading is retained even after taking a new GPS reading
Re: Saved GPS reading is retained even after taking a new GPS reading
This code is not saving the latitude and longitude. It is setting them to blank:
Try this:
Code: Select all
POLE_LATITUDE = gps(latitude);
savesetting("POLE_LATITUDE", "");
POLE_LONGITUDE = gps(longitude);
savesetting("POLE_LONGITUDE", "");
PROC POLE_GPS_TAKEN
preproc
errmsg("%s", loadsetting("POLE_LATITUDE"));
if loadsetting("POLE_LATITUDE") <> "" then
POLE_LATITUDE = tonumber(loadsetting("POLE_LATITUDE"));
endif;
if loadsetting("POLE_LONGITUDE") <> "" then
POLE_LONGITUDE = tonumber(loadsetting("POLE_LONGITUDE"));
endif;
onfocus
if visualvalue(POLE_LATITUDE) = 99 or visualvalue(POLE_LATITUDE) = notappl then
setvalueset($, GPS_NOT_TAKEN_VS2);
else
setvalueset($, GPS_TAKEN_VS1);
endif;
postproc
if $ = 1 then
// Take new GPS reading
gps(open);
if gps(read,60,10,"Reading GPS, Please wait...") = 1
and accept(maketext("Save this location? %f, %f",gps(latitude),gps(longitude)),"Yes","No") = 1 then
{if accept("Save this result", "Yes", "No") = 1 then}
POLE_LATITUDE = gps(latitude);
savesetting("POLE_LATITUDE",gps(latitude));
POLE_LONGITUDE = gps(longitude);
savesetting("POLE_LONGITUDE", gps(longitude));
gps(close);
ADVANCE TO COMPOUND_NUMBER;
else
errmsg("GPS signal could not be acquired");
gps(close);
reenter;
endif;
elseif $ = 2 then
// Show current readings on map
//execsystem(maketext("gps:%f,%f",
// visualvalue(LI_LATITUDE),
// visualvalue(LI_LONGITUDE)));
// reenter;
elseif $ = 3 then
// Keep the readings and move to next field
advance to COMPOUND_NUMBER;
elseif $ = 9 then
// Remove current readings
POLE_LATITUDE = 99.000000000;
POLE_LONGITUDE = 99.000000000;
endif;
preproc
errmsg("%s", loadsetting("POLE_LATITUDE"));
if loadsetting("POLE_LATITUDE") <> "" then
POLE_LATITUDE = tonumber(loadsetting("POLE_LATITUDE"));
endif;
if loadsetting("POLE_LONGITUDE") <> "" then
POLE_LONGITUDE = tonumber(loadsetting("POLE_LONGITUDE"));
endif;
onfocus
if visualvalue(POLE_LATITUDE) = 99 or visualvalue(POLE_LATITUDE) = notappl then
setvalueset($, GPS_NOT_TAKEN_VS2);
else
setvalueset($, GPS_TAKEN_VS1);
endif;
postproc
if $ = 1 then
// Take new GPS reading
gps(open);
if gps(read,60,10,"Reading GPS, Please wait...") = 1
and accept(maketext("Save this location? %f, %f",gps(latitude),gps(longitude)),"Yes","No") = 1 then
{if accept("Save this result", "Yes", "No") = 1 then}
POLE_LATITUDE = gps(latitude);
savesetting("POLE_LATITUDE",gps(latitude));
POLE_LONGITUDE = gps(longitude);
savesetting("POLE_LONGITUDE", gps(longitude));
gps(close);
ADVANCE TO COMPOUND_NUMBER;
else
errmsg("GPS signal could not be acquired");
gps(close);
reenter;
endif;
elseif $ = 2 then
// Show current readings on map
//execsystem(maketext("gps:%f,%f",
// visualvalue(LI_LATITUDE),
// visualvalue(LI_LONGITUDE)));
// reenter;
elseif $ = 3 then
// Keep the readings and move to next field
advance to COMPOUND_NUMBER;
elseif $ = 9 then
// Remove current readings
POLE_LATITUDE = 99.000000000;
POLE_LONGITUDE = 99.000000000;
endif;
Re: Saved GPS reading is retained even after taking a new GPS reading
Dear Josh,
I don't know how many times to thank you for your unflinching support and patience. Finally, am elated to bring to your attention that it now worked. Thanks so much.
I don't know how many times to thank you for your unflinching support and patience. Finally, am elated to bring to your attention that it now worked. Thanks so much.