How to navigate between apps?

In this tutorial you will learn how to navigate between two apps using action steps: run app with one param and open url. You will learn this from two apps: one will be your work hours register, and the other will allow you to add and edit work hours entries.

1. Lists


Create a new list called HOURS_REGISTER and add the following columns: ID, DATE, HOURS, PROJECT, USER, YEAR and MONTH. Set columns types like on the screen below and save the list.


1.2 (Optional step)

In SYSUSER list add the SUPERVISOR column and fill it for users.


2. App with work hours register


Create a new app and name it WORKING_HOURS_REGISTER. Add the User spreadsheet in it. In the first column, enter in the next three cells: User name, Identifier and Supervisor.

In the cell next to the identifier, enter the formula =CURRENTUSERID(), the formula will return the user who is currently editing the app.

In cells B1 and B3 enter the following formulas: =lookupvalue(sysuser,identifier=b2,name) and =lookupvalue(sysuser,identifier=b2,supervisor). These cells will return the name and supervisor from the sysuser table for the current user.



Add a new 5-column table called Register and change the 3 column headings to Dates, Working Hours, and Projects. Bind the section with the list HOURS_REGISTER and the columns with the appropriate columns as shown below.


In this section, data about working hours will appear.


Create another spreadsheet called Month with two cells, in first cell type the current month and in second - year. Set the type of the second cell to the drop-down list and enter =array('2019','2020','2021','2022') in the items and make that cell editable. This will allow the user to select the year from the drop-down list. Add two buttons and place them one on one side of the spreadsheet and the other on the other side. In the caption type arrows in the appropriate direction.



Create two not visible spreadsheets. Name the first of them "Months" and in its first column list all months names. Name the second "Help_date" and in first cell type formula date, which will return first day of the current month and year.



Add two 'set cell value' actions on the buttons with arrows.

First action will be changing date in "Help_date" by adding or subtracting (depending on the direction of the arrow) 1 to months amount. In cell address type first cell of "Help_date" Spreadsheet and in value field type formula: =ADDMONTHS(Help_date.a1,-1) (for left arrow) or =ADDMONTHS(Help_date.a1,1) (for right arrow).

Second action will type correct name of month in first cell of Month spreadsheet. In address cell field give Month.A1, in value field type formula: =nth(Months.A1:A12, MONTH(Help_date.A1)). 


Thanks to this, the user will be able to change the month in the cell using arrow buttons.


Go back to the table and go to it's options tab. In the filter option, add the following condition to the lookup formula: User=User.B2 && Year=number(Month.A2) && Month=Month.A1, as below.


Thanks to this, the table will show working hours in the month and year selected by the user.

3. An app for creating and editing working hours


Create a new app and name it ADDHOURS. Add a spreadsheet with two columns named To_fill. In the first column, type in cells: user, date, hours and project, as below. In the cell next to the cell with the user, enter the formula =currentuserid(). For the rest of the cells in the second column, change the types to date, number, and autocomplete and make them editable.


In cell B4, in the items, enter the formula =lookup(HOURS_REGISTER, Project). This will allow the user to enter a new project and select it from the HOURS_REGISTER list.


Add a rich text widget and enter 'Fill the data about working hours' in it.
In this spreadsheet, the user will be able to create or edit information about working hours.


Create again not visible "Months" Spreadsheet, in which type all months in first column.

Create a new spreadsheet called Data, change its visibility to false, it will be an auxiliary section that the user should not see. In the first column, type all working hours parameters in the cells (that is, all column names from the HOURS_REGISTER list).

In the cells next to the cells User, Date, Hours and Project, get the data from the appropriate cells in the To_fill section, as shown below.

In the cell next to the Year cell, type a formula =year(To_fill.B2). The formula will return the year from the date, which user enters.

In the cell next to the month cell, enter the formula "=nth(Months.A1:A12, MONTH(To_fill.B2))".
The month formula returns the month number of the date that user enters and according to this number the proper month name will be chosen form Months spreadsheet.


In the first cell of column B, a specific identifier will be created for each working hours using the formula: =HASH(CONCAT(To_fill.B1,TEXT(To_fill.B2),To_fill.B4)).
The Hash formula creates an unique string for the given text. In our case, Hash creates an ID from the user, date, and project.

Remark: In this case, you cannot enter two different entries about working hours for the same project and for one date. The hash for both entries would assign the same identifier, causing the second entry to overwrite the first.


Fill the Data field for each cell from column B in the properties tab. In the data field, enter the name of the HOURS_REGISTER list and after the dot, enter the name of the list column for the appropriate field. So for cell B1 enter HOURS_REGISTER.ID in the data field.


This will allow you to save the appropriate data into the list using the save to database action step.


Create a Workflow action button and go to the Workflow tab. Create a Save action coming from and entering the start state as below.


Go to the options of this action. In the execution condition, enter the formula: =if(ISEMPTY(To_fill.B3)||isempty(To_fill.B4),false,true)). In the error message, write 'Fill the project and working hours fields'.

If the cell for hours or project is empty, the action will not be performed and given message will appear.


Add two action steps on this action. First - save to database, enter the Data spreadsheet as a section, and HOUR_REGISTER as a list.

Second - Open URL, in the URL field enter the address of the page for the second app WORKING_HOURS_REGISTER (you can get the address when you save the app and add yourself as an editor and then run the app instance and copy the website address). Enter '_self' as target, this will make the URL open in the current tab.

After pressing the button, the data from the Data spreadsheet will be saved in the HOURS_REGISTER list and the WORKING_HOURS_REGISTER app will open.


In the info tab of the ADDHOURS app, add one input parameter and name it ID and set the type to Text. This will come in handy in the next steps.


4. Passing an input parameter


Go back to the WORKING_HOURS_REGISTER app and add a button with the caption New. In the actions, add 'Run app with one param' action, in the name of the app enter the ADDHOURS app, in the name of the parameter - ID, and set the target of the link to '_self'.


The button will be used to create a new entry about working hours. After clicking, the user will be transferred to the ADDHOURS application, where he will be able to fill the data about working hours and save them to the database. Later, the user will be redirected back to the WORKING_HOURS_REGISTER app, where the data of the created entry will show in the table.


Go back to column D of the Register table and set its type to link. Enter the link formula in it. As the first parameter of the formula, enter the text 'Edit'. As the second parameter enter the formula concat, in which give as arguments the website address of the ADDHOURS app, the text '&id=' and the E column.  


The link formula creates a link to the specified page and displays the provided text (in this case, Edit). The concat formula combines the given texts into one text. In this case, it creates the url to the ADDHOURS application with the ID parameter equal to the value from column E. After clicking this link, the second application will open and the id parameter will be passed to it with the id value for these working hours.


Go back to the ADDHOURS app designer and bind the To_fill spreadsheet with the HOURS_REGISTER list. In the options of this spreadsheet in the filter, add a condition to the lookup: id=input(id).

When the user presses Edit, the ADDHOURS app will be given a parameter with the ID value for those working hours. The input formula returns the value of the input parameter, so this spreadsheet will show the working hours data that the user wants to edit.


In the appropriate cells enter = and the name of the column from which the data are to be taken, as above. For a cell with a date, type an if formula that will check if the date is empty, if so, it will return today's date, if not, it will return a date for the edited working hours.

5. Test

Remember to set yourself as a draft creator in both apps.


Run the WORKING_HOURS_REGISTER app. You should see what is on the screenshot below.


You should be able to change the month using the arrow buttons and after pressing the year button, select the year from the drop-down list. Press the New button.


You should be moved to the ADDHOURS app with a partially empty spreadsheet. Try to save without filling the fields - you should get an error message. Enter the number of hours and project (so far there is nothing in the autocomplete list, but the next time it should show the project you entered). After filling in, press the save button.



You should go back to the WORKING_HOURS_REGISTER app and the table should show the working hours entry you just created. This way, you can create more entries about working hours, and they will appear in the table in the appropriate year and month.


Press Edit in column D.


You should be moved to the ADDHOURS app, and the spreadsheet should contain data for this entry that you want to edit. After changing, save.


You should go back to the WORKING_HOURS_REGISTER app and the corrected entry should appear in the table.

Have more questions? Submit a request


Article is closed for comments.
Powered by Zendesk