This document explains a simple example to upload images to agentry server folder.
- Create an object named ‘Image1’ at module level.
- Add two fields ‘Image ID’ with data type as ‘String’ and ‘Image Field’ with data type as ‘External Data’ property.
- Set ‘Image ID’ property as key property.
- Add ‘Image1’ Object to the collection property of main object.
- Define an Add transaction for the ‘Image 1’ object with ‘Image ID’ and ‘Image Field’ as transaction properties.
- Set the Key Property of the transaction to ‘Image ID’
- Select the ‘Image ID’ transaction property in the properties view.Select Initial Value to ‘Rule-Before Data Entry’.Add a new rule as shown to locally store the Images uniquely on the mobile device
- Define a new File System Connection
- Create the required tables at MS Sql backend ‘Syclo Image IDX ref’ with ‘Local ID’, ‘Real ID’,’User ID’,’Server ID’ fields .Define a function to generate ‘Image ID’s’.
- Create two folders ‘Uploaded Files’ and ‘Uploaded Files Tmp’ in the server root folder
- Define a string global type with value set to the path of the folder created in agentry server
- Define another global to set the format of the image to ‘.JPEG’
- Define SQL steps ‘Get Real Image ID’, ‘Insert Image IDX ref’,’Insert Image Upload’ with following code
- Add a step with step type as ‘File Document Management’,select the system connection as ‘FileSystem via FileSystem’.Click on next and fill the attributes as shown and finish the wizard
- Make sure that the delete script file check box is unchecked,if not the .bat files generated will be deleted automatically
- Define Document mapping as shown
- Select Document Management Script, and define the script as follows and save
- Define the following update steps to the add transaction
- Design a screen set for the image object with a list screen
- Design a screen set for add image transaction.Set the Image Field edit type to image capture
- Define an action with step type as navigation to switch the screen to image list screen
- Define an action with step type as transaction
- Define a detail screen in the main screen set.Add a field with type as button.Set the width,size and other attributes according to the requirements.Map the actions as shown in the screen shot
- Add the buttons to the list screen of image object
- Define styles and map to the screen fields type according to the requirements
- Publish the application to agentry server,a prompt to modify the agentry.ini file will be displayed.
- Set the temp path in agentry.ini file for file system connection as follows.All the batch files will be stored in this temp path.Save the file and restart the agentry server once the modifications are done
- Publish to the agentry server and test in ATE
- Click on ‘Upload Image’
- Click on Add Image button number of images to be uploaded to agentry server.Click on image capture icon to select the images from local device
- Iam adding four images to upload in to agentry server .
- Check the messages in transmit dialog box
- Check whether the images are uploaded to agentry server ‘Uploaded Files’ folder,check the files in ‘Uploaded Files Tmp’ folder and also the image id is stored at the backend table
Back end table
Note:Similarly we can even upload documents to agentry server,just try to create the another object and follow the above steps by making necessary changes to meet object names,screen sets etc….
Hope this may be helpful