Template
Trucks WF 2
A demo App using Work flow rules to change data in other tables.
[This section usually shows the "Purpose" of the app, as defined in the Properties section of the app definition]
Loading...
Also see:
tablet mode & fullscreen mode
How we built this app
Changing Data in another Table with a Workflow Rule
How to change data in your app when some event happens. 28/5/19
Using App TrucksWF
This workflow rule can be used to Change one or more data values in one or more tables.
Suppose your app has a Jobs table and a Drivers table. Each row in the Jobs table records a single Job, and each row in the Drivers table records a single driver. The Jobs table references the Drivers table, which means that each job must be assigned to one driver. You want to design the app such that every time a new job is added, the assigned status [Assigned?] of the corresponding driver will be automatically updated to "Assigned" and the [Assigned Truck] column will be updated with the drivers current Truck.
To do this:
1. Create an Action
Name - "Update Driver Status".
For a record of this table - Drivers table
Do this - Data: set the value of a column
Set this column - [Assigned?]
To this value - “Assigned”
Prominence - Do not display
Only if this condition is true - true
Needs confirmation - Off
2. Create an Action
Name - "Update Drivers Truck"
For a record of this table - Drivers table
Do this - Data: set the value of a column
Set this column - [Truck]
To this value - SELECT(JOBS[Truck ID],[Driver ID]=[_THISROW].[UNIQUEID])
Prominence - Do not display
Only if this condition is true - true
Needs confirmation - Off
3. Create a (grouped) Action
Name - "Update Drivers Table "
For a record of this table - Drivers table
Do this - Grouped: execute a sequence of actions
Actions - "Update Driver Status".
"Update Drivers Truck"
Prominence - Do not display
Only if this condition is true - true
Needs confirmation - Off
4. Create an Action
Name - “Get Drivers to Update”
For a record of this table - Jobs table
Do this - Data: execute an action on a set of rows
Referenced table - Drivers
Referenced rows - SELECT(Drivers[UNIQUEID],[UNIQUEID]=[_THISROW].[Driver ID])
Referenced action - "Update Drivers Table "
Prominence - Do not display
Only if this condition is true - true
Needs confirmation - Off
5. Create a workflow rule
Name - "On Adding New Job"
Target data - Jobs
Update event - "ADDS_ONLY"
Reaction - Change Data
Action name - Action 1
Name of Action to be taken - “Get Drivers to Update”
Each time a new job is added to the Jobs table, the "On Adding New Job" workflow will be triggered. This workflow will invoke the action “Get Drivers to Update”, which will select the Drivers to be updated from the Drivers table. Once the Drivers have been selected, the action "Update Drivers Table "will be applied to each selected Driver, which will change the Driver’s status to "Assigned" and add the ID of the truck to the Truck column.
Note that any number of actions can be added to the "Update Drivers Table" action.
Using the same App I can use a workflow rule to reset the values of the [Assigned?]
and [Truck] columns back to blank when the job is completed and the Driver and Truck are free again.
1. Create an Action
Name - "Reset Assigned".
For a record of this table - Drivers table
Do this - Data: set the value of a column
Set this column - [Assigned?]
To this value - “”
Prominence - Do not display
Only if this condition is true - true
Needs confirmation - Off
2. Create an Action
Name - "Reset Truck"
For a record of this table - Drivers table
Do this - Data: set the value of a column
Set this column - [Truck]
To this value - “”
Prominence - Do not display
Only if this condition is true - true
Needs confirmation - Off
3. Create a (grouped) Action
Name - "Resets group "
For a record of this table - Drivers table
Do this - Grouped: execute a sequence of actions
Actions - "Reset Assigned"
"Reset Truck"
Prominence - Do not display
Only if this condition is true - true
Needs confirmation - Off
4. Create an Action
Name - “Get Drivers to Reset”
For a record of this table - Jobs table
Do this - Data: execute an action on a set of rows
Referenced table - Drivers
Referenced rows - SELECT(Drivers[UNIQUEID],[Completed?]="TRUE")
Referenced action - "Resets group"
Prominence - Do not display
Only if this condition is true - true
Needs confirmation - Off
5. Create a workflow rule
Name - "Reset Drivers"
Target data - Jobs
Update event - "UPDATES_ONLY"
Reaction - Change Data
Action name - Action 1
Name of Action to be taken - “Get Drivers to Reset”
Each time a job is updated in the Jobs table, eg by using the quick edit column to set the Job as “Completed”, the “Reset Drivers" workflow will be triggered. This workflow will invoke the action “Get Drivers to Reset”, which will select the Drivers to be updated from the Drivers table. Once the Drivers have been selected, the action "Resets group "will be applied to each selected Driver, which will change the Driver’s status to "" and the ID of the truck in the Truck column to””.
This is a preview of the data sets used in the app.
Data
This is a high-level model of both the data entities and the UI elements in the app.
Loading...