From this tutorial you will learn how to create a master-detail section and how to launch one app from another.
You will create two apps - one with a work shift form and one for choosing to whom we want to send the form. The second one will also be launching the form app.
1.Create the sending app
Add two widgets- a spreadsheet and a table. Bind the table with "Sysuser" list. It's a list that contains information about all of your qalcwise site users. All of the columns bind with list fields: email, name, isactive.
Hide B and C columns by putting =false in visibility field.
Put header names into first spreadsheet row. Bind the spreadsheet section with the table by filing the 'filter' field with a lookup formula.
Now bind cells with table columns. You can do it by manually writing the column names in cells:
Set C2 cell type to 'Checkbox'.
What you have just created is a master-detail section - a special type of section with a spreadsheet and a table in which form the smaller table section (master) we choose an element for which information we view in the spreadsheet (detail). ( read more )
2. Work shift form
Create a new app. Add a new table section. Change its headers to: start hour, end hour and shift duration.
Set type of two first column to "DateTime". In third column set the type as Number and fill it with a formula like below. It will calculate the duration of the shift.
An employee's email is the parameter that will be passed from the sending app to this one. We need to specify that in our app. You need to add a new input parameter type text.
Now save changes and go back to your first app. Add a new 'button' widget. Click on it and add a new 'run app with one param' action. In action options put second app name, parameter name and the field in which email is located - parameter value that we will be passing.
Save the first app and go back to second. Add a new workflow actions widget.
In workflow tab create 3 new states:
Create 3 new actions:
-ask the employee
The scheme of our workflow:
5.Passing the parameter
Add a new spreadsheet section with one column. In first cell put a question to your employee about the shift e.g. "Can you take this shift?".
In second cell chosen employee's email will be shown. To make it possible put an input formula in this cell with the passed parameter name in brackets.
Go to workflow tab and add the 'set editors' actionstep to action 'ask the employee'. In 'Editors' field put address of the cell that we created in the previous step (the input cell). Now only the employee that was sent the form will be able to make a decision to accept the shift or not.
See how your app works. You can do it either by clicking the 'preview' button or by simply running the app. If you want to run it remember to add yourself as the creator of both apps beforehand.
A correctly working app should run the app with the shift form after clicking the button.
But what if we wanted to ask all of the employees at the same time?
There is a simple way to do so.
Open the sending app. In column A of the table add 'Email' alias. Add workflow actions widget. Next, go to workflow tab and create one action and one state: 'send to all' and 'sent'.
Add a new actionstep 'distribute app from table' to 'send to all' action. Go to actionstep options and there fill in the app field, table section and alias for the column in which the email is.
Now, we would want to send shift hours to all employees, but we cannot do that using the form. Let's do it using the sending app.
Add two new columns to the right side of the table. We need them to pass start time and end time parameters. Add 'start_time' and 'end_time' aliases to them and set them as editable. Change the headers to same names as aliases. Set them as 'DateTime' type.
Save the distributing app and go to form app. Add two new input parameters named the same as previous aliases: 'start_time' and 'end_time'. Set their type as 'DateTime'.
In A and B columns put input formula and in its brackets write time parameters names which will be passed to them
Thanks to these changes you now have two possible options while asking about the shift : sending to all employees at once or to a single employee.
Sending to all employees looks like this: