How to capture Photograph in cspro
Re: How to capture Photograph in cspro
Did you create the photos folder? The logic:
string photoFilename = maketext("%sphotos/photo-%d-%02d-%03d.jpg",
pathname(Application),
DISTRICT, VILLAGE, HOUSEHOLD_NUMBER);
sets the path the folder that the photo to be saved in to a in the photos subfolder of the application folder. For example if you put your application in csentry/myapp and you have district 1, village 1, household 1 then it will try to save the photo as csentry/myapp/photos/photo-1-01-001.jpg. So if the photos directory doesn't exist then the photo won't get saved.
You get the out of range when you enter 2 or 3 because the photo doesn't exist to it uses the second value set which doesn't include 2 or 3. You should set the capture type for the photo field to radio button so that you can see the value set.
string photoFilename = maketext("%sphotos/photo-%d-%02d-%03d.jpg",
pathname(Application),
DISTRICT, VILLAGE, HOUSEHOLD_NUMBER);
sets the path the folder that the photo to be saved in to a in the photos subfolder of the application folder. For example if you put your application in csentry/myapp and you have district 1, village 1, household 1 then it will try to save the photo as csentry/myapp/photos/photo-1-01-001.jpg. So if the photos directory doesn't exist then the photo won't get saved.
You get the out of range when you enter 2 or 3 because the photo doesn't exist to it uses the second value set which doesn't include 2 or 3. You should set the capture type for the photo field to radio button so that you can see the value set.
-
- Posts: 12
- Joined: July 14th, 2014, 4:00 pm
Re: How to capture Photograph in cspro
I really appreciated your information. Everything is going well. Thank you one more time.
-
- Posts: 12
- Joined: July 14th, 2014, 4:00 pm
Re: How to capture Photograph in cspro
Just one more thing. How can I remove these blank space in the middle of the photo name? (please, consider blank spaces instead of underscore Ex: photo-034-hd_______-25082015.jpg
I am using this code:
I also would like concatenate the hour after the date, is it possible? ex: photo-034-alesson-25082015-1215.jpg
thank you for your attention
I am using this code:
Code: Select all
string photoFilename = maketext("%sphotos/photo-%03d-%s-%d.jpg",pathname(application),N_QUEST,NOME,sysdate("DDMMYYYY"));
thank you for your attention
Re: How to capture Photograph in cspro
The blank spaces are probaby coming from the alpha variable N_QUEST. Use the strip() function to remove the trailing spaces i.e. strip(N_QUEST). To add the hour you would use the function systime().
-
- Posts: 12
- Joined: July 14th, 2014, 4:00 pm
Re: How to capture Photograph in cspro
Thank you again, it really worked.
Re: How to capture Photograph in cspro
alesson_aguiar wrote:Josh, thank you for your answer. This is just what I did. but let me tell you what is happening. First, after I enter 1, I take the photo but it is not stored in any folder and I don´t know why. Second, if I enter 2 or 3, I receive "WARNING: Out of range! Please enter a valid value for PHOTO" Can you see and explain it for me, Please?josh wrote:You add them the same way you would any value set to the dictionary. Click on the variable named "photo" and then click on "add value set" on the toolbar. Do this once for each of the two value sets.alesson_aguiar wrote:Please, would you mind telling me how I can set these values? I really appreciate any explanation and it would be better if you copy a print of the setvalue page with these informations. Thank you.
Did you use the code Josh gave? It works, I used the same one this weekend on some tests and I'm very happy with the results. It saves the photos in a folder I named "Pictures" and sets a specific name for each photo.
Don't make many changes, the only change I recommend would be the variables names if you have diferent one . I also added a variable to store the file name and it worked well.
The only thing that didn't work was "refused" option.
Re: How to capture Photograph in cspro
Did you use the code Josh gave? It works, I used the same one this weekend on some tests and I'm very happy with the results. It saves the photos in a folder I named "Pictures" and sets a specific name for each photo.
Don't make many changes, the only change I recommend would be the variables names if you have diferent one . I also added a variable to store the file name and it worked well.
The only thing that didn't work was "refused" option.
Don't make many changes, the only change I recommend would be the variables names if you have diferent one . I also added a variable to store the file name and it worked well.
The only thing that didn't work was "refused" option.
Re: How to capture Photograph in cspro
Thank you for constructive comments the forum have been provided. I just go through the page on the discussion about photo. When i take photo i want to save each photos with name,so what should i write in logic?? Suppose i have the following items
Region is a numeric with length 2, District is a numeric with length 2, Ward is a numeric with Length 3, Name of head of household (Alpha with 10 letters), Photo..
I will appreciate if i get such solution
I want the photo to be saved by name of head of household
Thank you
Albert Kapala
Region is a numeric with length 2, District is a numeric with length 2, Ward is a numeric with Length 3, Name of head of household (Alpha with 10 letters), Photo..
I will appreciate if i get such solution
I want the photo to be saved by name of head of household
Thank you
Albert Kapala
-
- Posts: 573
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: How to capture Photograph in cspro
I have done like this
if visualvalue ($(curocc()))=notappl then
execsystem(maketext("camera:%s%04d%03d%03d%07s.jpg",pathname(inputfile),TPS_FEMALE_DICT.PC_NUM,TPS_FEMALE_DICT.Q8, PID_DR, "F_T22_Pic"));
//TPS_FEMALE_DICT.PC_NUM=Processing Code; TPS_FEMALE_DICT.Q8=Household ID; PID_DR=PID from Desk Registration
endif;
Best
a.
if visualvalue ($(curocc()))=notappl then
execsystem(maketext("camera:%s%04d%03d%03d%07s.jpg",pathname(inputfile),TPS_FEMALE_DICT.PC_NUM,TPS_FEMALE_DICT.Q8, PID_DR, "F_T22_Pic"));
//TPS_FEMALE_DICT.PC_NUM=Processing Code; TPS_FEMALE_DICT.Q8=Household ID; PID_DR=PID from Desk Registration
endif;
Best
a.
Re: How to capture Photograph in cspro
am also developing an application using the examples above. but am getting an error after capturing the photo. it says "Camera error,
There was a problem saving your photo or video". I cant figure out the problem
There was a problem saving your photo or video". I cant figure out the problem