0

In my scenario I'm using the image capture screen for taking photos of specific machines.

In the replies the name of the images is 1427726930.jpg

Can this name be changed I'd like to have a prefix like: UIDxxxxxxTSxxxxxx.jpg

Bohemian
  • 412,405
  • 93
  • 575
  • 722
lrs_coolik
  • 81
  • 6
  • Sorry the format is not quite clear. What exactly do you mean by UIDxxxxxxTSxxxxxx.jpg ? – André Schäfer Apr 09 '15 at 14:15
  • 1
    Ok, the new naming should be concatenated by the participant id and the timestamp. The participant id should have the prefix UID and the timestamp TS. At the end the name of the image needs to be UID123456789TS1427726930.jpg – lrs_coolik Apr 09 '15 at 14:22

1 Answers1

1

It is possible to override the auto generated name in the image capture screen, by calling setAnswerValue on the Answer that contains the image after capturing. For your scenario this can look as follows:

        <question key="#1" type="10" title="">

            <answer key="#1_1" nextQuestionKey="END"/>

            <onLeaveOkPersistAssignment>
                init = getAnswerValue($answer:'#1_1');
                renamed = conCat('ID', getUserId(), '-', init);
                setAnswerValue($answer:'#1_1', renamed);
                newName = getAnswerValue($answer:'#1_1');
            </onLeaveOkPersistAssignment>

        </question>

calling getAnswerValue returns the auto generated name which is a numeric timestamp followed by the file extension. This is practically the part of your pattern after the TS. So all you have to do is to retrieve the participant ID and to concatenate everything in the right order.

André Schäfer
  • 608
  • 5
  • 15