Taking photos on the Navbar
Posted: July 27th, 2018, 3:12 pm
Hi, I created two navbar buttons that would take a photo and display a photo for the current case. I would like the photo to be named with the ID items. However, when I take the photo, the photo name is blank even if I take it after entering the ID items. My code is below.
When I press the button, I get a photo with the name " - - - .jpg". As I said before, It happens even after entering RNDNO, EDNO, STRATUM and HHNO. Is there a reason for this? I've tried it with and without visualvalue on the variables.
Code: Select all
PROC GLOBAL
string photoDir, //Stores the location of the photos folder
photoFileName //filename of photo
;
//Function to take a photo using the device's camera. It saves to a filename matching the ID items
function takePhoto()
if direxist(photoDir) then
execsystem(maketext("camera:%s",photoFileName));
else
dircreate(photoDir);
execsystem(maketext("camera:%s",photoFileName));
endif;
end;
//Function to view photo of current case
function viewPhoto()
if direxist(photoDir) then
execsystem(maketext("view:%s", photoFileName));
else
dircreate(photoDir);
execsystem(maketext("view:%s", photoFileName));
endif;
end;
PROC LABOURFORCE_FF
preproc
photoFileName = pathname(CSEntry) + maketext("Menu/Photos/%03d-%03d-%d-%03d.jpg", visualvalue(RNDNO),visualvalue(EDNO),visualvalue(STRATUM),visualvalue(HHNO)); //DEBUG: Not saving file with Rndno, edno, and stratum
photoDir = pathname(CSEntry) + "Menu/Photos";
userbar(clear);
userbar(add button, "Get Location", getgps()); //adds a "Get location" button to get coordinates
userbar(add button, "Take a photo for the current case", takePhoto()); //adds a button to take a photo of current case.
userbar(add button, "View photo of current case", viewPhoto()); //adds a button to view photo of current case
userbar(show);