Page 1 of 1

Possible bug when updating current field from a user function

Posted: August 30th, 2018, 3:08 pm
by Don
Hi,

I have an application where when the user gets to the latitude field, they are prompted to press "Get location" in the navbar. It calls a getlocation function with uses the gps to get the coordinates and then fills the latitude and longitude fields automatically. The problem is that the field I'm currently on, which is the latitude field, does not get updated but the other field gets updated.

To illustrate, I've attached my application. If you run the application in the Questionnaire folder and
1. Go into the partially saved case ( 1 12011 1)
2. Make sure that the Latitude field is highlighted
3. Press "Get Location" in the navbar and get a location.
4. The longitude field is updated with the coordinate, but the latitude field is not

The code i'm using is:

Code: Select all

//Function uses device's GPS feature to get Location
function getgps()
	gps(open);
	if gps(read,60,10,"Reading GPS, Please wait...") = 1 then	//read up to 60 seconds. if successful...
		//execsystem(maketext("gps:%f,%f", gps(latitude),gps(longitude)));
		if accept(maketext("Save this location? %f, %f",gps(latitude),gps(longitude)),"Yes","No") = 1 then	//if yes
			LATITUDE = gps(latitude);
			LONGITUDE = gps(longitude);
		endif;
	else
		errmsg("Gps location failed, Please try again");
		LATITUDE = notappl;
		LONGITUDE = notappl;
	endif;
	gps(close);
end;
There is no code in the LATITUDE or LONGITUDE procs

Is there any way to work around this? I believe it only affects android.

Re: Possible bug when updating current field from a user function

Posted: August 30th, 2018, 6:14 pm
by josh
Try adding a reenter at the end of your getps function. I haven't tried it myself but it might force the field to update.

Re: Possible bug when updating current field from a user function

Posted: September 3rd, 2018, 12:49 pm
by Don
Hi Josh,

Unfortunately, putting a reenter anywhere in the function doesn't seem to do anything.

Re: Possible bug when updating current field from a user function

Posted: September 4th, 2018, 12:23 pm
by Don
Ok I worked around this by prompting the user to run the getgps function before entering the LATITUDE or LONGITUDE fields. I also set those fields to protected so that there's no way that the user can run the function while in those fields.

Re: Possible bug when updating current field from a user function

Posted: September 4th, 2018, 1:27 pm
by josh
Glad you found a workaround. We will fix the problem in version 7.2 so that the field value will be updated after executing user bar function.