Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

Overview

On this lesson, we are going to review the “Upload” control that will help us to allocate files under an specific repository in Wayfast. File uploading is a feature for accepting and managing images, videos, PDFs, or other documents. A file uploader looks like a button on a website that opens a dialogue box where they can choose, attach, and submit files. Let’s understand how we can setup this control in simple steps!

Preconditions

1-Create a new table in SQL

Initially we need to create a new table in our database to connect the “Upload” action with the Wayfast repository where we are going to allocate the files.

...

  • spWF_CRM_Activities_CreateOrUpdate

  • spWF_CRM_Activities_Delete

  • spWF_CRM_Activities_Get

2-Create a Repository table to storage the files

It’s important to create another object Repository_File_Repository as a generic table to storage all the files loaded from the Upload control in Wayfast.

...

Info

If the table already exist or we want to point to an existing table, this step is not required.

3-Create a new stored procedure

We need to create an stored procedure “sp_CRM_Activities_Insert” to establish the connection between the “CRM_Activities” table for upload and the Wayfast repository using the RepositoryId as key parameter to identify in which place this should be stored.

...

Now that we insert the “RepositoryID” into the Repository_File_Repository table, we can use the information to display all the files in grid table under any page in the application. Using this stored procedure, we will handle the file insertion on the table where we allocate all the files in the repository.

How to create an Upload control?

Now that we have the table and the stored procedure created, we can start creating the “Upload” control. Let’s synchronize first the objects created in database to make sure that they are now visible in Wayfast.

...

Don’t forget to click on “Submit” button to create our new “Upload” control and finish the process.

...

How to preview all the uploaded files in the Application?

In our later example, we created the control and the action to upload files. We can use this first example to make all the files visible, for example, on a grid table. Let’s check how we can show this information from “Upload” control in our application and make these files available to be listed or downloadable.

Step 1-Create a new dataset to get the information from Upload Files table

Before start with the grid table, it’s necessary to create a new dataset in the page.

...

We can take note on the relationship between the “Upload” control and this dataset by clicking on “Add Relationship” button. Click on “Submit” button to generate the dataset. Now we are ready to make the files visible in the screen.

Step 2-Create a new action using the Stored Procedure to store the information from Upload Files table

Click on “Upload” link

...

Navigate to “Data Binding” tab

...

Now that we have the dataset and the new stored procedure to retrieve the file’s information from the table that we stored the objects when uploading those files, let’s create the grid table to display the information in the application.

Step 3 - Create the Grid Controls to make visible the Uploaded files in the page

Initially we are going to set set 3 columns, one to display the “Filename”, another one to “Download” the file and finally one to “Delete” the file from the table.

...

Once the files are uploaded into the Wayfast repository, we can observe the “File”, “Download” and “Delete” columns that shows the information from all the listed files that the we uploaded in the application.

...

How to display an image uploaded into a Wayfast Repository?

select Img='<img src=image.ashk?IdRepositorio='+Cast(@RepositoryId, Varchar)

Recap

In the first part, we revised the preconditions to create a new table in database to stored all the uploaded files in our repository. We understand the important connection between the “Upload” control and the action for this purpose. In the second part, we dove into all the uploaded files in the repository and display them on a grid table that every user can check to download the stored information.