In this tutorial you will learn how to use attachments with the help of a.o. formulas attachmentnames and attachmenturl.
We will create two apps which operating on browsing candidates for work. One app will act as a formula for the candidate. The other one will store information about all candidates taken into account; it will also allow the person using in to quickly get to know people who applied for a certain post.
1.Create a new app
Add a spreadsheet and an attachments section in it. The spreadsheet should have two columns and four rows. Fill it in as below. Set blank cells as editable.
This will be the candidate's formula in which he or she will fill his data in.
Now, add cells B1-B4 aliases. You can do it by putting the chosen alias name in 'alias' field in cell options (below an example for B1 cell). We will use these aliases in further part of this tutorial.
Next, in attachments section, in which the candidate will attach his or her photo type 'add a suitable photo here'.
2.Add a second spreadsheet
and place in it a formula like the one below. 'Attachmentnames' formula creates an array of names of attachments from a chosen attachments section. 'First' formula returns first element of a given array - in our case the name of one and only added attachment. Name this cell's alias 'photo'. Hide the section by putting '=false' in section's visibility options.
3.Add workflow actions widget
And go to workflow tab. In it add one state and one action. You can name them as shown below.
In 'app info' tab add yourself or 'all' as authors.
5.Create the second app
In it add a table widget. Bind it with the previously created app by using lookup formula in 'filter' field : =lookup(add_candidate), where add_candidate is the name of the first app.
Then use aliases of spreadsheet cells from the previous app. Bind table columns with these cells by putting aliases names as shown:
This way we will be able to display candidate info added in first app in the second app.
Add one more table column and bind it with first app's spreadsheet in which we returned added attachment name. It is the one to which cell's we added 'photo' alias. Using this alias bind column E. Use boundattachmenturl formula with the alias to get link to the attachment instead of just its name.
Add a spreadsheet widget and bind it with the table using lookup formula. The spreadsheet should have two columns and five rows. Then fill in second column cell's with alias name the same way as you did in the table.
Go back to the table. Columns C-E set as hidden by putting =false in 'visibility' field of the columns.
Thanks to these few steps by clicking on one of possible candidates (in the table after the changes only name and surname will be visible) in the table, we will see more details about this person in the spreadsheet.
7.Viewing the photo
Add image section and workflow actions widget. In 'url' field in image section put address of the last cell of spreadsheet's second column.
Go to workflow tab and add one state and one action in it. It will be an action which we will take when ending candidate browsing. You can then name the action and the state for example: 'finish' and 'finished'.
Add yourself or 'All' as authors of the app in app info tab.
9.Run the app
Now, run the app to test it out. Start from 'add_candidate'. Run it a couple of times to add different candidates.
Run the second app and choose a person from the list.