<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://prsdigital.com.au/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kenric</id>
	<title>PRS - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://prsdigital.com.au/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kenric"/>
	<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php/Special:Contributions/Kenric"/>
	<updated>2026-06-16T07:06:58Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Security_Token&amp;diff=239</id>
		<title>Security Token</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Security_Token&amp;diff=239"/>
		<updated>2023-02-02T09:14:23Z</updated>

		<summary type="html">&lt;p&gt;Kenric: Redirected page to Security Tokens&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Security_Tokens]]&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Security_Tokens&amp;diff=238</id>
		<title>Security Tokens</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Security_Tokens&amp;diff=238"/>
		<updated>2023-02-02T09:14:09Z</updated>

		<summary type="html">&lt;p&gt;Kenric: Removed redirect to Security Token&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;PRS governs user rights to access modules and actions via Security Tokens&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Tokens may allow or restrict rights to view, edit, create or delete on a certain screen&lt;br /&gt;
* Tokens may also allow or restrict rights to do specific actions (e.g. &amp;quot;Can Archive Deliveries&amp;quot;)&lt;br /&gt;
*Users can be assigned default access or restrictions based on their Security Groups (see Part 2)&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. To view or change an individual user&#039;s Security Tokens:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1.1 Open the System Tab → Security Defaults&lt;br /&gt;
&lt;br /&gt;
1.2 Find the token to be changed (grouped by functionality)&lt;br /&gt;
&lt;br /&gt;
1.3 Find the user to change tokens for (top right)&lt;br /&gt;
&lt;br /&gt;
1.4 Click the appropriate square to enable / disable as needed. Green or light green is enabled, red is disabled&lt;br /&gt;
[[File:Security tokens.png|none|thumb|1392x1392px|&#039;&#039;&#039;2. To view or change Security Groups (for a group of Users):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2.1 Open the Human Resources tab → User Accounts&lt;br /&gt;
&lt;br /&gt;
2.2 Find the &amp;quot;Setup&amp;quot; button on the top right → open Security Groups[[File:Security group list.png|none|thumb|450x450px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2.3 Edit an existing group or create a new one (green plus button on the bottom left corner)&lt;br /&gt;
&lt;br /&gt;
2.4 Users can be added to a security group by editing the User[[File:User security group.png|none|thumb|450x450px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Security_Tokens&amp;diff=237</id>
		<title>Security Tokens</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Security_Tokens&amp;diff=237"/>
		<updated>2023-02-02T09:13:48Z</updated>

		<summary type="html">&lt;p&gt;Kenric: Redirected page to Security Token&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Security_Token]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PRS governs user rights to access modules and actions via Security Tokens&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Tokens may allow or restrict rights to view, edit, create or delete on a certain screen&lt;br /&gt;
* Tokens may also allow or restrict rights to do specific actions (e.g. &amp;quot;Can Archive Deliveries&amp;quot;)&lt;br /&gt;
*Users can be assigned default access or restrictions based on their Security Groups (see Part 2)&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. To view or change an individual user&#039;s Security Tokens:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1.1 Open the System Tab → Security Defaults&lt;br /&gt;
&lt;br /&gt;
1.2 Find the token to be changed (grouped by functionality)&lt;br /&gt;
&lt;br /&gt;
1.3 Find the user to change tokens for (top right)&lt;br /&gt;
&lt;br /&gt;
1.4 Click the appropriate square to enable / disable as needed. Green or light green is enabled, red is disabled&lt;br /&gt;
[[File:Security tokens.png|none|thumb|1392x1392px|&#039;&#039;&#039;2. To view or change Security Groups (for a group of Users):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2.1 Open the Human Resources tab → User Accounts&lt;br /&gt;
&lt;br /&gt;
2.2 Find the &amp;quot;Setup&amp;quot; button on the top right → open Security Groups[[File:Security group list.png|none|thumb|450x450px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2.3 Edit an existing group or create a new one (green plus button on the bottom left corner)&lt;br /&gt;
&lt;br /&gt;
2.4 Users can be added to a security group by editing the User[[File:User security group.png|none|thumb|450x450px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=File:Report_Manager_Button.png&amp;diff=158</id>
		<title>File:Report Manager Button.png</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=File:Report_Manager_Button.png&amp;diff=158"/>
		<updated>2023-01-10T01:10:56Z</updated>

		<summary type="html">&lt;p&gt;Kenric: Kenric uploaded a new version of File:Report Manager Button.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Button to open the report manager&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=157</id>
		<title>Report Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=157"/>
		<updated>2023-01-10T01:07:31Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Creating a Report */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Report Template system gives the ability to generate reports based on the data with PRS, assisting in displaying and reporting on whatever is required. All main panels within PRS allow for reports, and each can have as many reports as is required.&lt;br /&gt;
&lt;br /&gt;
== Creating a Report ==&lt;br /&gt;
[[File:Report Manager Button.png|thumb|310x310px|The button to open the Report Manager]]&lt;br /&gt;
To create a report, you will need the &amp;quot;Design Reports&amp;quot; [[Security Token]].&lt;br /&gt;
Then, simply navigate to any screen on PRS, and click &amp;quot;Setup -&amp;gt; Reports&amp;quot;, as displayed in the picture. This will open up a new grid, from which you can create new report templates. Each report template in this grid acts as a &amp;quot;template&amp;quot; for the report; it tells PRS how to display the data. To create a new report, simply click the &amp;quot;+&amp;quot; button down the bottom, and fill in the required fields.&lt;br /&gt;
&lt;br /&gt;
=== Fields ===&lt;br /&gt;
&lt;br /&gt;
==== Name ====&lt;br /&gt;
The name is the name of the report, displayed in the main ribbon of PRS. It should be descriptive about what data the report displays.&lt;br /&gt;
&lt;br /&gt;
==== Visible ====&lt;br /&gt;
Determines whether the report should be visible in PRS. If this is not checked, there will be no way to generate the report. This should be used when you have old reports that are no longer necessary, but you don&#039;t want to delete them in case you need them again, or, if you are currently working on a report&#039;s design and don&#039;t want it to be visible yet.&lt;br /&gt;
&lt;br /&gt;
==== All Records / Selected Records ====&lt;br /&gt;
These fields determine what data should be used in the report. Most panels in PRS have a way to select data, and these fields determine whether all data in PRS should be used, or just the records that have been selected. If neither are selected, the report will not be able to be generated. If both are selected, there will be an option to choose which one when generating the report later on.&lt;br /&gt;
&lt;br /&gt;
=== Loading &amp;amp; Saving ===&lt;br /&gt;
On the left hand side of the report grid, there are two buttons for loading and saving reports from/to files. This allows you to take a report template and reload it somewhere else. Note that this is prone to errors, since a report is intrinsically tied to the type of data that is being loaded; hence, if you export a report for [[Kanban|Tasks]] and then import it for [[Job|Projects]], there will most likely be errors, since the data that represents a Job is different from that of a Task. Hence, this is not recommended unless you know what you are doing.&lt;br /&gt;
&lt;br /&gt;
== Report Design ==&lt;br /&gt;
&lt;br /&gt;
Reports can be designed from two places in PRS - first, from the Report Manager, where you create new reports (See [[#Creating a Report|Creating a Report]]). On the right hand-side of this grid, there is a pencil icon, which, if clicked, brings up the report designer.&lt;br /&gt;
&lt;br /&gt;
The other place that reports can be designed from is the preview window, brought up by clicking on the report in the ribbon (See [[#Printing Reports|Printing Reports]]). From the preview window, click the pencil icon in the top right, and this opens the designer. If designed this way, there is also data pre-loaded into the report, since you have previewed the report. This means that you can design the report and then preview with data already loaded, assisting you to design based on how the end product will look with data.&lt;br /&gt;
&lt;br /&gt;
PRS uses the [https://www.fast-report.com/en/ FastReport] engine and designer for its reporting system, and so details on how to use the report designer can be found on their [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/Fundamentals.html online documentation]. That being said, there are several important points that can be mentioned here as well.&lt;br /&gt;
&lt;br /&gt;
=== Previewing ===&lt;br /&gt;
&lt;br /&gt;
The report can be previewed from the designer. Click on &amp;quot;File -&amp;gt; Preview...&amp;quot; This will preview the current report as you&#039;ve designed it. Note that this does not save the report, so don&#039;t forget to return to the designer and hit the save button to ensure your changes are committed. Also, if you loaded the report from the PRS ribbon, instead of the report manager (see [[#Printing Reports|Printing Reports]]), then this preview will use the data that was loaded when printing the report.&lt;br /&gt;
[[File:Choose data.png|thumb|Choose Report Data]]&lt;br /&gt;
&lt;br /&gt;
=== Selecting Data ===&lt;br /&gt;
&lt;br /&gt;
The data to be loaded into the report comes in the form of tables; each table corresponds to a specific &amp;quot;type&amp;quot; of data. An &amp;quot;Employee&amp;quot; table will contain data for [[Employee|Employees]], and an &amp;quot;Equipment&amp;quot; table contains data about [[Equipment]]. A few of the table names are slightly different than what they might appear in PRS, e.g. the table for [[Task|Tasks]] is named &amp;quot;Kanban&amp;quot;. So when you want to generate a report on your tasks, the data you will need will be in the &amp;quot;Kanban&amp;quot; table.&lt;br /&gt;
&lt;br /&gt;
Each table has a number of columns which map to the individual properties of an object, so &amp;quot;Kanban&amp;quot; has columns for its &amp;quot;Number&amp;quot;, its &amp;quot;Title&amp;quot;, and many others. Each row of the table is a specific object.&lt;br /&gt;
&lt;br /&gt;
It is important to tell PRS what data you need - there exists a vast number of tables that PRS knows how to load, but you will not want PRS to load all this data, since that can take a while. To choose the data you want to report on, navigate to &amp;quot;Data -&amp;gt; Choose Report Data...&amp;quot;. This will bring up a menu from which you can select a number of tables to load data for. Several of these are loaded by default, such as the &amp;quot;CompanyInformation&amp;quot; table, &amp;quot;CompanyLogo&amp;quot; table and the table related to the specific data - generating a report for tasks will automatically load the &amp;quot;Kanban&amp;quot; table. Other tables that &#039;&#039;can&#039;&#039; be loaded (but are not by default) are those that are related to the main object. So, since tasks can have associated equipment items, there is also a &amp;quot;Kanban_Equipment&amp;quot; table. The &amp;quot;Kanban_&amp;quot; prefix represents the fact that this is, in a way, a &amp;quot;child table&amp;quot; of &amp;quot;Kanban&amp;quot; - there is a link between the tables. The report designer knows about these relationships between the tables, so the associated relationships can be modelled using the report designer&#039;s concepts of Detail Bands (see the [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/DataBand/MasterDetailRelations.html documentation]). In order to tell PRS to also load the equipment associated with the tasks, check the little box next to &amp;quot;Kanban_Equipment&amp;quot;, so that it displays a tick. Then, next time you preview the report (by closing and re-opening the report), PRS will also load the data required.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;quot;Kanban_Equipment&amp;quot; table does not load every piece of equipment in PRS - it only loads the equipment items that are related to the tasks that you selected - if only one task was selected to generate the report, then the &amp;quot;Kanban_Equipment&amp;quot; table will have at most &#039;&#039;one&#039;&#039; equipment item, since only one piece of equipment is able to be attached to a task.&lt;br /&gt;
&lt;br /&gt;
You can also select particular columns from the data selection window, but at this stage this does not cause less data to be loaded - it just prevents it being displayed in the various windows in the report designer and thus removes from view unnecessary fields that clutter up the screen.&lt;br /&gt;
&lt;br /&gt;
=== Using Data ===&lt;br /&gt;
[[File:Data window.png|thumb|216x216px|Data window]]&lt;br /&gt;
On the right-hand side of the designer is a &amp;quot;Data&amp;quot; window (if this is not present, click on &amp;quot;View -&amp;gt; Data&amp;quot;). From here you can get data to be displayed in the report. Expand the &amp;quot;Data Sources&amp;quot; menu and you will see a list of the tables you have loaded. Expand any one of them, and then you will see a collection of fields you can select from. To use a field, click and drag from this window over onto the report. For many types of data, this will automatically create a label filled with a placeholder that tells the report engine that you intend to use a data field here. (The syntax for this placeholder is the table name, followed by a dot, followed by the field name, and surrounded in square brackets - e.g., &amp;amp;lsqb;Kanban.Title&amp;amp;rsqb;&lt;br /&gt;
[[File:Data selection arrow.png|left|thumb|110x110px|Data selection arrow]]&lt;br /&gt;
Also, some data is automatically recognised as an image. For example, if you expand the &amp;quot;CompanyLogo&amp;quot; table, and drag the &amp;quot;Data&amp;quot; field onto the report, it will render as an image using the logo of your company (set in the [[Company Information]] screen). Additionally, dates are recognised as dates, and check boxes (such as the &amp;quot;Private&amp;quot; field for tasks) are rendered as check boxes.&lt;br /&gt;
&lt;br /&gt;
The data fields can also be set by clicking the little arrow that appears in the top-right of report objects when hovering over them, as shown in the image. If you click on that, you can select a data field for the object (note that the associated data band must be set, see [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/DataBand/SimpleListReport/PrintDataRows.html the documentation]).&lt;br /&gt;
&lt;br /&gt;
== Printing Reports ==&lt;br /&gt;
&lt;br /&gt;
Once you have created and designed a report, it is now ready to be generated/printed. In PRS, navigate to the panel where you created the report, and, if the report was set to [[#Visible|Visible]], it will now appear in the bar at the top. This will be visible to anyone with the &amp;quot;Print Reports&amp;quot; [[Security Token]], and by clicking on the report, the relevant data will be assembled, and the report generated from the data.&lt;br /&gt;
&lt;br /&gt;
Generating the report will open the report preview window, from which you view, print, or save to PDF. Additionally, if you have the &amp;quot;Design Reports&amp;quot; [[Security Token]], then there will also be a pencil icon, which you can click to edit the report in the designer, allowing for a quick backwards and forwards between the design and preview modes. Additionally, since generating the report allows means there is now data to print from, it is often easier to design a report by first printing it to give it some data to work with, and then designing from the preview window, allowing you to see the changes that you make by clicking &amp;quot;Preview&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Database_Service&amp;diff=156</id>
		<title>Database Service</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Database_Service&amp;diff=156"/>
		<updated>2022-12-16T06:08:25Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:PRS Database Service Account Settings.png|none|thumb]]&lt;br /&gt;
The PRS database service is the engine room of PRS, providing access to one or more PRS databases.  In most cases, only one main database is required - however, there may be circumstances (for instance, multiple divisions or companies using the same infrastructure) where more than one database service may be running at the same time.&lt;br /&gt;
&lt;br /&gt;
To add a database service, click the &amp;quot;Add Service&amp;quot; button at the bottom right of the screen, and select &amp;quot;Database&amp;quot;:&lt;br /&gt;
[[File:PRS Add Database.png|none|thumb]]&lt;br /&gt;
The Database Properties screen will appear, allowing you to customise the service as required:&lt;br /&gt;
[[File:PRS Database Service General Settings.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
* The &amp;quot;Name&amp;quot; field provides a description of the database, which can be automatically provided to clients if the AutoDiscovery Service is enabled&lt;br /&gt;
&lt;br /&gt;
* The &amp;quot;File Name&amp;quot; filed indicates the location of the (not-yet-created) database itself - click the &amp;quot;Select&amp;quot; button at the right to choose a location and file name for the database.  If you have an existing database file, you can select this here to use the existing data - it will not be overwritten or erased.&lt;br /&gt;
* The &amp;quot;Port&amp;quot; field indicates the TCP port that the database service will listen on for client requests.  This port should be configured to allow traffic through any firewalls you may have installed.&lt;br /&gt;
&lt;br /&gt;
To ensure that the service can be validly installed on your system, click on the &amp;quot;Account&amp;quot; tab, and enter the Domain, User name and Password  for an account that has privileges to install services on your system:&lt;br /&gt;
[[File:PRS Database Server Account Details.png|none|thumb]]&lt;br /&gt;
(If you are using a local account, use &amp;quot;.&amp;quot; as the Domain Name)&lt;br /&gt;
&lt;br /&gt;
At this point you should see the Database Service appear in the list of available services:&lt;br /&gt;
[[File:PRS Database Service Status.png|none|thumb]]&lt;br /&gt;
The &amp;quot;Disk&amp;quot; image at the left indicates that this service is a Database.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Pause&amp;quot; image indicates that the service currently stopped - click this will start the service, after which the image will change to a &amp;quot;tick&amp;quot;:&lt;br /&gt;
[[File:PRS Database Service - Running.png|none|thumb]]&lt;br /&gt;
Once the service is running, a &amp;quot;target&amp;quot; indicator will appear in the right-hand column - clicking this will display a debug console to allow you to monitor service activity:&lt;br /&gt;
[[File:PRS Database Console.png|none|thumb]]&lt;br /&gt;
Since this log is reset when the debug console is closed, a full log can be found in a log file which is saved to the &amp;quot;Local System&amp;quot; service account&#039;s AppData folder. This can be found under &amp;quot;C:\Windows\System32\config\systemprofile\AppData\Roaming\PRSServer\PRSDatabase&amp;quot; folder as a &amp;quot;.log&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the service is successfully running, you can move on to adding and configuring additional services as required:&lt;br /&gt;
&lt;br /&gt;
* Add an [[AutoDiscovery Service|Auto Discovery Service]] to allow client workstations to automatically find and connect to this database&lt;br /&gt;
*Add a [[GPS Gateway Service]] to capture incoming GPS data from Digital Matter IoT devices&lt;br /&gt;
*Add a [[Scheduling Service|Scheduler Service]] to perform regular actions on you database&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Web_Template&amp;diff=155</id>
		<title>Web Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Web_Template&amp;diff=155"/>
		<updated>2022-12-16T02:13:32Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Visible */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Web Templates are the manner in which the Web Engine interfaces with a user, written in HTML with C# support using the Razor templating engine. Upon receiving a request from a user, the WebEngine finds the template that is required and then executes it, recompiling if changes have been made.&lt;br /&gt;
==Fields==&lt;br /&gt;
&lt;br /&gt;
===DataModel===&lt;br /&gt;
&lt;br /&gt;
The DataModel field is a name of an entity type, such as Equipment or Employee, which specifies the specific data to load for the page template. For example, if you are writing a page which lists employees, it is useful to preload the data necessary - this is done by setting DataModel to &amp;quot;Employee&amp;quot;. This field is optional.&lt;br /&gt;
&lt;br /&gt;
===Slug ===&lt;br /&gt;
&lt;br /&gt;
The Slug field denotes the name of the page itself, intended to be a short text field which describes the function of the page. Note that it cannot contain any slashes (&#039;/&#039;, &#039;\&#039;), and should use only characters which are URL-safe; when in doubt, stick to just numbers and letters.&lt;br /&gt;
&lt;br /&gt;
The DataModel and slug fields combine to form a path to the page, with the form &#039;&#039;www.domain.com/v1/DataModel/Slug?id=XXXXXXXX-XXXX-XXXX-XXXXXXXX&#039;&#039;. If the DataModel field is empty, then the URL is simply &#039;&#039;www.domain.com/v1/Slug&#039;&#039;. This allows you to create pages which do not have to be tied to a specific entity. If a page has a DataModel and the id query does not match any page, then a 404 Not Found is returned to the user.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
The Description field is a non-functional field which allows you to add a description to the template - this is not necessary, but can be useful as a reference.&lt;br /&gt;
&lt;br /&gt;
=== Template ===&lt;br /&gt;
&lt;br /&gt;
The source code for the template, which is in the Razor syntax - a mix of C# and HTML.&lt;br /&gt;
&lt;br /&gt;
===Visible===&lt;br /&gt;
&lt;br /&gt;
The Visible field denotes whether the page is accessibly via a URL - if it is not visible, then a 404 Not Found is returned when trying to access it - it is as if it didn&#039;t exist. Use this if you want to disable a page or if the template is only relevant in the context of other templates - see [[#Partial%20Templates|Partial Templates]]&lt;br /&gt;
&lt;br /&gt;
=== Root URL ===&lt;br /&gt;
&lt;br /&gt;
This field is default to false. It defines whether the URL of the page is a root URL, or whether it is prefixed by &amp;quot;v1/&amp;quot; (The default is the prefix). We have the prefix so that we can add our own endpoints to the Web Engine, such as the &amp;quot;/login&amp;quot; endpoint, without clashing with any endpoints that you have created. However, if you do want to remove the prefix, untick this box. In order to allow you to choose a URL which is guaranteed to never clash with our own endpoints, you can start your [[#Slug|slug]] with a capital letter - we reserve all lowercase letter slugs that are not prefixed with &amp;quot;v1/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Tick this box at your own risk, since if we add an endpoint in future that has the same name as a page you have added, your page will effectively become inaccessible.&lt;br /&gt;
&lt;br /&gt;
==Writing a Template==&lt;br /&gt;
To write a template, you should be familiar with HTML, CSS and JavaScript as well as C#, which is used for non-static content.&lt;br /&gt;
===Basics===&lt;br /&gt;
At its base, a template is an HTML file - that is, that one can write a static web page, without the use of C#, and it would display as it would in a browser. Note that this has no means of accessing any resources outside of the page, so any styling with CSS must be embedded.&lt;br /&gt;
&lt;br /&gt;
The page is then able to contain embedded C# code, using the Razor syntax. Roughly, one can embed a C# expression by preceding it with an &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt;, e.g. &amp;lt;code&amp;gt;@employee.Name&amp;lt;/code&amp;gt;. If the expression is too complex, surround it with parentheses, &amp;lt;code&amp;gt;@(GenericMethod&amp;lt;string&amp;gt;())&amp;lt;/code&amp;gt;. To execute blocks of code, use &amp;lt;code&amp;gt;@{ ... }&amp;lt;/code&amp;gt;, and for control structures like &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;foreach&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; should come before the keyword, e.g. &amp;lt;code&amp;gt;@if(condition){ ... }&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Within a block of code, one can return to HTML simply by using HTML tags, e.g.&amp;lt;pre&amp;gt;&lt;br /&gt;
@if(condition){&lt;br /&gt;
    &amp;lt;p&amp;gt;Condition is true&amp;lt;/p&amp;gt;&lt;br /&gt;
} else {&lt;br /&gt;
    string error = &amp;quot;Condition is false&amp;quot;;&lt;br /&gt;
    &amp;lt;p&amp;gt;@error&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Styling===&lt;br /&gt;
To add a stylesheet, you can create a [[PRS/WebStyle|WebStyle]], which can be loaded with &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(string code)&amp;lt;/code&amp;gt;, which retrieves the content of that stylesheet as raw text. Thus, to use a WebStyle with the code &amp;quot;MAIN&amp;quot;, one would put in the &amp;lt;code&amp;gt;&amp;amp;lt;head&amp;amp;gt;&amp;lt;/code&amp;gt; tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;style&amp;amp;gt; @(WebDatabaseInterface.GetStylesheet(&amp;quot;MAIN&amp;quot;).Style) &amp;amp;lt;/style&amp;amp;gt;&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This would load that stylesheet into the current web page.&lt;br /&gt;
&lt;br /&gt;
If multiple stylesheets need to be loaded, consider using &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheets(params string[] stylesheetCodes)&amp;lt;/code&amp;gt;, which gets all the stylesheets in request.&lt;br /&gt;
===Using DataModels===&lt;br /&gt;
The Razor engine provides to each template page a parameter called &amp;lt;code&amp;gt;Model&amp;lt;/code&amp;gt;, by which data can be retrieved. By default, it contains no data except for a table called &amp;quot;User&amp;quot;, which contains the current user. To load the required data for the page, a call to &amp;lt;code&amp;gt;Model.LoadModel(string[] requiredTables, params IDataModelQueryDef[] requiredQueries)&amp;lt;/code&amp;gt; must be executed.&lt;br /&gt;
&lt;br /&gt;
The first parameter, &amp;lt;code&amp;gt;requiredTables&amp;lt;/code&amp;gt;, specifies which tables should be loaded. By default, &amp;lt;code&amp;gt;LoadModel&amp;lt;/code&amp;gt; loads nothing. In general, the CompanyInformation, CompanyLogo and the current entity are useful to load, so a call could look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Model.LoadModel(new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;})&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second parameter specifies a way to narrow the load of the data, preventing unnecessary data from being loaded. For example, if one only requires the ID and Name fields of an employee, one might call:&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(&lt;br /&gt;
    new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;},&lt;br /&gt;
    new DataModelQueryDef&amp;lt;Employee&amp;gt;(&lt;br /&gt;
        null,&lt;br /&gt;
        new Columns&amp;lt;Employee&amp;gt;(x =&amp;gt; x.ID).Add(x =&amp;gt; x.Name),&lt;br /&gt;
        null)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default, all columns in the database are loaded, so this is a way to drastically reduce the amount of data loaded. (The other two fields, set to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, specify a filter and sort order for the retrieved data.)&lt;br /&gt;
====Retrieving Data====&lt;br /&gt;
To get a table that has been loaded, use &amp;lt;code&amp;gt;Model.GetTable&amp;lt;T&amp;gt;(alias)&amp;lt;/code&amp;gt;. This returns an object of type &amp;lt;code&amp;gt;CoreTable&amp;lt;/code&amp;gt;, which has a property &amp;lt;code&amp;gt;Rows&amp;lt;/code&amp;gt;, through which one can retrieve data. An example is shown here.&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(new string[] {&amp;quot;Employee&amp;quot;}); // Load Model&lt;br /&gt;
CoreTable employeeTable = Model.GetTable&amp;lt;Employee&amp;gt;(); // Get Table from Model&lt;br /&gt;
&lt;br /&gt;
// Iterate through the rows&lt;br /&gt;
foreach(CoreRow row in employeeTable.Rows){&lt;br /&gt;
    // Convert the row to an Employee. This is not necessary, and the data can also be retrieved with row[ColumnName] or row.ToDictionary()[ColumnName]&lt;br /&gt;
    var employee = row.ToObject&amp;lt;Employee&amp;gt;();&lt;br /&gt;
    &amp;lt;p&amp;gt;@employee.ID: @employee.Name&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Partial Templates===&lt;br /&gt;
Sometimes it is useful to write a &#039;&#039;partial template&#039;&#039;, that is, one that only represents part of a web page and is used elsewhere, e.g. a header which is used site-wide. This is possible. First, create a web template with the Visible property unchecked. Leave the DataModel blank, since that is only useful when loading the page from an HTTP request. For this example, give it the Slug &#039;&#039;header&#039;&#039;, and set its content to be:&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;header&amp;gt;&lt;br /&gt;
    &amp;lt;h1&amp;gt;The Title&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;Then, within the main page, call &amp;lt;code&amp;gt;@Raw(WebHandler.RunTemplate(WebDatabaseInterface.GetWebTemplateBySlug(&amp;quot;header&amp;quot;), Model))&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Through this, the header will be inserted into the main page. Note that @Raw is required, for otherwise the retrieved HTML will be displayed as plain text, rather than interpreted as HTML.&lt;br /&gt;
&lt;br /&gt;
This method can also be used for loading stylesheets which must load styling information non-statically. Simply save the stylesheet as a WebTemplate instead of as a WebStyle, and the load it as a template.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Web_Template&amp;diff=154</id>
		<title>Web Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Web_Template&amp;diff=154"/>
		<updated>2022-12-16T02:13:24Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Visible */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Web Templates are the manner in which the Web Engine interfaces with a user, written in HTML with C# support using the Razor templating engine. Upon receiving a request from a user, the WebEngine finds the template that is required and then executes it, recompiling if changes have been made.&lt;br /&gt;
==Fields==&lt;br /&gt;
&lt;br /&gt;
===DataModel===&lt;br /&gt;
&lt;br /&gt;
The DataModel field is a name of an entity type, such as Equipment or Employee, which specifies the specific data to load for the page template. For example, if you are writing a page which lists employees, it is useful to preload the data necessary - this is done by setting DataModel to &amp;quot;Employee&amp;quot;. This field is optional.&lt;br /&gt;
&lt;br /&gt;
===Slug ===&lt;br /&gt;
&lt;br /&gt;
The Slug field denotes the name of the page itself, intended to be a short text field which describes the function of the page. Note that it cannot contain any slashes (&#039;/&#039;, &#039;\&#039;), and should use only characters which are URL-safe; when in doubt, stick to just numbers and letters.&lt;br /&gt;
&lt;br /&gt;
The DataModel and slug fields combine to form a path to the page, with the form &#039;&#039;www.domain.com/v1/DataModel/Slug?id=XXXXXXXX-XXXX-XXXX-XXXXXXXX&#039;&#039;. If the DataModel field is empty, then the URL is simply &#039;&#039;www.domain.com/v1/Slug&#039;&#039;. This allows you to create pages which do not have to be tied to a specific entity. If a page has a DataModel and the id query does not match any page, then a 404 Not Found is returned to the user.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
The Description field is a non-functional field which allows you to add a description to the template - this is not necessary, but can be useful as a reference.&lt;br /&gt;
&lt;br /&gt;
=== Template ===&lt;br /&gt;
&lt;br /&gt;
The source code for the template, which is in the Razor syntax - a mix of C# and HTML.&lt;br /&gt;
&lt;br /&gt;
===Visible===&lt;br /&gt;
&lt;br /&gt;
The Visible field denotes whether the page is accessibly via a URL - if it is not visible, then a 404 Not Found is returned when trying to access it - it is as if it didn&#039;t exist. Use this if you want to disable a page or if the template is only relevant in the context of other templates - see [[Partial%20Templates|Partial Templates]]&lt;br /&gt;
&lt;br /&gt;
=== Root URL ===&lt;br /&gt;
&lt;br /&gt;
This field is default to false. It defines whether the URL of the page is a root URL, or whether it is prefixed by &amp;quot;v1/&amp;quot; (The default is the prefix). We have the prefix so that we can add our own endpoints to the Web Engine, such as the &amp;quot;/login&amp;quot; endpoint, without clashing with any endpoints that you have created. However, if you do want to remove the prefix, untick this box. In order to allow you to choose a URL which is guaranteed to never clash with our own endpoints, you can start your [[#Slug|slug]] with a capital letter - we reserve all lowercase letter slugs that are not prefixed with &amp;quot;v1/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Tick this box at your own risk, since if we add an endpoint in future that has the same name as a page you have added, your page will effectively become inaccessible.&lt;br /&gt;
&lt;br /&gt;
==Writing a Template==&lt;br /&gt;
To write a template, you should be familiar with HTML, CSS and JavaScript as well as C#, which is used for non-static content.&lt;br /&gt;
===Basics===&lt;br /&gt;
At its base, a template is an HTML file - that is, that one can write a static web page, without the use of C#, and it would display as it would in a browser. Note that this has no means of accessing any resources outside of the page, so any styling with CSS must be embedded.&lt;br /&gt;
&lt;br /&gt;
The page is then able to contain embedded C# code, using the Razor syntax. Roughly, one can embed a C# expression by preceding it with an &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt;, e.g. &amp;lt;code&amp;gt;@employee.Name&amp;lt;/code&amp;gt;. If the expression is too complex, surround it with parentheses, &amp;lt;code&amp;gt;@(GenericMethod&amp;lt;string&amp;gt;())&amp;lt;/code&amp;gt;. To execute blocks of code, use &amp;lt;code&amp;gt;@{ ... }&amp;lt;/code&amp;gt;, and for control structures like &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;foreach&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; should come before the keyword, e.g. &amp;lt;code&amp;gt;@if(condition){ ... }&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Within a block of code, one can return to HTML simply by using HTML tags, e.g.&amp;lt;pre&amp;gt;&lt;br /&gt;
@if(condition){&lt;br /&gt;
    &amp;lt;p&amp;gt;Condition is true&amp;lt;/p&amp;gt;&lt;br /&gt;
} else {&lt;br /&gt;
    string error = &amp;quot;Condition is false&amp;quot;;&lt;br /&gt;
    &amp;lt;p&amp;gt;@error&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Styling===&lt;br /&gt;
To add a stylesheet, you can create a [[PRS/WebStyle|WebStyle]], which can be loaded with &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(string code)&amp;lt;/code&amp;gt;, which retrieves the content of that stylesheet as raw text. Thus, to use a WebStyle with the code &amp;quot;MAIN&amp;quot;, one would put in the &amp;lt;code&amp;gt;&amp;amp;lt;head&amp;amp;gt;&amp;lt;/code&amp;gt; tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;style&amp;amp;gt; @(WebDatabaseInterface.GetStylesheet(&amp;quot;MAIN&amp;quot;).Style) &amp;amp;lt;/style&amp;amp;gt;&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This would load that stylesheet into the current web page.&lt;br /&gt;
&lt;br /&gt;
If multiple stylesheets need to be loaded, consider using &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheets(params string[] stylesheetCodes)&amp;lt;/code&amp;gt;, which gets all the stylesheets in request.&lt;br /&gt;
===Using DataModels===&lt;br /&gt;
The Razor engine provides to each template page a parameter called &amp;lt;code&amp;gt;Model&amp;lt;/code&amp;gt;, by which data can be retrieved. By default, it contains no data except for a table called &amp;quot;User&amp;quot;, which contains the current user. To load the required data for the page, a call to &amp;lt;code&amp;gt;Model.LoadModel(string[] requiredTables, params IDataModelQueryDef[] requiredQueries)&amp;lt;/code&amp;gt; must be executed.&lt;br /&gt;
&lt;br /&gt;
The first parameter, &amp;lt;code&amp;gt;requiredTables&amp;lt;/code&amp;gt;, specifies which tables should be loaded. By default, &amp;lt;code&amp;gt;LoadModel&amp;lt;/code&amp;gt; loads nothing. In general, the CompanyInformation, CompanyLogo and the current entity are useful to load, so a call could look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Model.LoadModel(new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;})&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second parameter specifies a way to narrow the load of the data, preventing unnecessary data from being loaded. For example, if one only requires the ID and Name fields of an employee, one might call:&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(&lt;br /&gt;
    new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;},&lt;br /&gt;
    new DataModelQueryDef&amp;lt;Employee&amp;gt;(&lt;br /&gt;
        null,&lt;br /&gt;
        new Columns&amp;lt;Employee&amp;gt;(x =&amp;gt; x.ID).Add(x =&amp;gt; x.Name),&lt;br /&gt;
        null)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default, all columns in the database are loaded, so this is a way to drastically reduce the amount of data loaded. (The other two fields, set to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, specify a filter and sort order for the retrieved data.)&lt;br /&gt;
====Retrieving Data====&lt;br /&gt;
To get a table that has been loaded, use &amp;lt;code&amp;gt;Model.GetTable&amp;lt;T&amp;gt;(alias)&amp;lt;/code&amp;gt;. This returns an object of type &amp;lt;code&amp;gt;CoreTable&amp;lt;/code&amp;gt;, which has a property &amp;lt;code&amp;gt;Rows&amp;lt;/code&amp;gt;, through which one can retrieve data. An example is shown here.&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(new string[] {&amp;quot;Employee&amp;quot;}); // Load Model&lt;br /&gt;
CoreTable employeeTable = Model.GetTable&amp;lt;Employee&amp;gt;(); // Get Table from Model&lt;br /&gt;
&lt;br /&gt;
// Iterate through the rows&lt;br /&gt;
foreach(CoreRow row in employeeTable.Rows){&lt;br /&gt;
    // Convert the row to an Employee. This is not necessary, and the data can also be retrieved with row[ColumnName] or row.ToDictionary()[ColumnName]&lt;br /&gt;
    var employee = row.ToObject&amp;lt;Employee&amp;gt;();&lt;br /&gt;
    &amp;lt;p&amp;gt;@employee.ID: @employee.Name&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Partial Templates===&lt;br /&gt;
Sometimes it is useful to write a &#039;&#039;partial template&#039;&#039;, that is, one that only represents part of a web page and is used elsewhere, e.g. a header which is used site-wide. This is possible. First, create a web template with the Visible property unchecked. Leave the DataModel blank, since that is only useful when loading the page from an HTTP request. For this example, give it the Slug &#039;&#039;header&#039;&#039;, and set its content to be:&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;header&amp;gt;&lt;br /&gt;
    &amp;lt;h1&amp;gt;The Title&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;Then, within the main page, call &amp;lt;code&amp;gt;@Raw(WebHandler.RunTemplate(WebDatabaseInterface.GetWebTemplateBySlug(&amp;quot;header&amp;quot;), Model))&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Through this, the header will be inserted into the main page. Note that @Raw is required, for otherwise the retrieved HTML will be displayed as plain text, rather than interpreted as HTML.&lt;br /&gt;
&lt;br /&gt;
This method can also be used for loading stylesheets which must load styling information non-statically. Simply save the stylesheet as a WebTemplate instead of as a WebStyle, and the load it as a template.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Web_Template&amp;diff=153</id>
		<title>Web Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Web_Template&amp;diff=153"/>
		<updated>2022-12-16T02:13:04Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Web Templates are the manner in which the Web Engine interfaces with a user, written in HTML with C# support using the Razor templating engine. Upon receiving a request from a user, the WebEngine finds the template that is required and then executes it, recompiling if changes have been made.&lt;br /&gt;
==Fields==&lt;br /&gt;
&lt;br /&gt;
===DataModel===&lt;br /&gt;
&lt;br /&gt;
The DataModel field is a name of an entity type, such as Equipment or Employee, which specifies the specific data to load for the page template. For example, if you are writing a page which lists employees, it is useful to preload the data necessary - this is done by setting DataModel to &amp;quot;Employee&amp;quot;. This field is optional.&lt;br /&gt;
&lt;br /&gt;
===Slug ===&lt;br /&gt;
&lt;br /&gt;
The Slug field denotes the name of the page itself, intended to be a short text field which describes the function of the page. Note that it cannot contain any slashes (&#039;/&#039;, &#039;\&#039;), and should use only characters which are URL-safe; when in doubt, stick to just numbers and letters.&lt;br /&gt;
&lt;br /&gt;
The DataModel and slug fields combine to form a path to the page, with the form &#039;&#039;www.domain.com/v1/DataModel/Slug?id=XXXXXXXX-XXXX-XXXX-XXXXXXXX&#039;&#039;. If the DataModel field is empty, then the URL is simply &#039;&#039;www.domain.com/v1/Slug&#039;&#039;. This allows you to create pages which do not have to be tied to a specific entity. If a page has a DataModel and the id query does not match any page, then a 404 Not Found is returned to the user.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
The Description field is a non-functional field which allows you to add a description to the template - this is not necessary, but can be useful as a reference.&lt;br /&gt;
&lt;br /&gt;
=== Template ===&lt;br /&gt;
&lt;br /&gt;
The source code for the template, which is in the Razor syntax - a mix of C# and HTML.&lt;br /&gt;
&lt;br /&gt;
===Visible===&lt;br /&gt;
&lt;br /&gt;
The Visible field denotes whether the page is accessibly via a URL - if it is not visible, then a 404 Not Found is returned when trying to access it - it is as if it didn&#039;t exist. Use this if you want to disable a page or if the template is only relevant in the context of other templates - see [[WebTemplate#Partial%20Templates|Partial Templates]]&lt;br /&gt;
&lt;br /&gt;
=== Root URL ===&lt;br /&gt;
&lt;br /&gt;
This field is default to false. It defines whether the URL of the page is a root URL, or whether it is prefixed by &amp;quot;v1/&amp;quot; (The default is the prefix). We have the prefix so that we can add our own endpoints to the Web Engine, such as the &amp;quot;/login&amp;quot; endpoint, without clashing with any endpoints that you have created. However, if you do want to remove the prefix, untick this box. In order to allow you to choose a URL which is guaranteed to never clash with our own endpoints, you can start your [[#Slug|slug]] with a capital letter - we reserve all lowercase letter slugs that are not prefixed with &amp;quot;v1/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Tick this box at your own risk, since if we add an endpoint in future that has the same name as a page you have added, your page will effectively become inaccessible.&lt;br /&gt;
&lt;br /&gt;
==Writing a Template==&lt;br /&gt;
To write a template, you should be familiar with HTML, CSS and JavaScript as well as C#, which is used for non-static content.&lt;br /&gt;
===Basics===&lt;br /&gt;
At its base, a template is an HTML file - that is, that one can write a static web page, without the use of C#, and it would display as it would in a browser. Note that this has no means of accessing any resources outside of the page, so any styling with CSS must be embedded.&lt;br /&gt;
&lt;br /&gt;
The page is then able to contain embedded C# code, using the Razor syntax. Roughly, one can embed a C# expression by preceding it with an &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt;, e.g. &amp;lt;code&amp;gt;@employee.Name&amp;lt;/code&amp;gt;. If the expression is too complex, surround it with parentheses, &amp;lt;code&amp;gt;@(GenericMethod&amp;lt;string&amp;gt;())&amp;lt;/code&amp;gt;. To execute blocks of code, use &amp;lt;code&amp;gt;@{ ... }&amp;lt;/code&amp;gt;, and for control structures like &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;foreach&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; should come before the keyword, e.g. &amp;lt;code&amp;gt;@if(condition){ ... }&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Within a block of code, one can return to HTML simply by using HTML tags, e.g.&amp;lt;pre&amp;gt;&lt;br /&gt;
@if(condition){&lt;br /&gt;
    &amp;lt;p&amp;gt;Condition is true&amp;lt;/p&amp;gt;&lt;br /&gt;
} else {&lt;br /&gt;
    string error = &amp;quot;Condition is false&amp;quot;;&lt;br /&gt;
    &amp;lt;p&amp;gt;@error&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Styling===&lt;br /&gt;
To add a stylesheet, you can create a [[PRS/WebStyle|WebStyle]], which can be loaded with &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(string code)&amp;lt;/code&amp;gt;, which retrieves the content of that stylesheet as raw text. Thus, to use a WebStyle with the code &amp;quot;MAIN&amp;quot;, one would put in the &amp;lt;code&amp;gt;&amp;amp;lt;head&amp;amp;gt;&amp;lt;/code&amp;gt; tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;style&amp;amp;gt; @(WebDatabaseInterface.GetStylesheet(&amp;quot;MAIN&amp;quot;).Style) &amp;amp;lt;/style&amp;amp;gt;&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This would load that stylesheet into the current web page.&lt;br /&gt;
&lt;br /&gt;
If multiple stylesheets need to be loaded, consider using &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheets(params string[] stylesheetCodes)&amp;lt;/code&amp;gt;, which gets all the stylesheets in request.&lt;br /&gt;
===Using DataModels===&lt;br /&gt;
The Razor engine provides to each template page a parameter called &amp;lt;code&amp;gt;Model&amp;lt;/code&amp;gt;, by which data can be retrieved. By default, it contains no data except for a table called &amp;quot;User&amp;quot;, which contains the current user. To load the required data for the page, a call to &amp;lt;code&amp;gt;Model.LoadModel(string[] requiredTables, params IDataModelQueryDef[] requiredQueries)&amp;lt;/code&amp;gt; must be executed.&lt;br /&gt;
&lt;br /&gt;
The first parameter, &amp;lt;code&amp;gt;requiredTables&amp;lt;/code&amp;gt;, specifies which tables should be loaded. By default, &amp;lt;code&amp;gt;LoadModel&amp;lt;/code&amp;gt; loads nothing. In general, the CompanyInformation, CompanyLogo and the current entity are useful to load, so a call could look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Model.LoadModel(new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;})&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second parameter specifies a way to narrow the load of the data, preventing unnecessary data from being loaded. For example, if one only requires the ID and Name fields of an employee, one might call:&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(&lt;br /&gt;
    new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;},&lt;br /&gt;
    new DataModelQueryDef&amp;lt;Employee&amp;gt;(&lt;br /&gt;
        null,&lt;br /&gt;
        new Columns&amp;lt;Employee&amp;gt;(x =&amp;gt; x.ID).Add(x =&amp;gt; x.Name),&lt;br /&gt;
        null)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default, all columns in the database are loaded, so this is a way to drastically reduce the amount of data loaded. (The other two fields, set to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, specify a filter and sort order for the retrieved data.)&lt;br /&gt;
====Retrieving Data====&lt;br /&gt;
To get a table that has been loaded, use &amp;lt;code&amp;gt;Model.GetTable&amp;lt;T&amp;gt;(alias)&amp;lt;/code&amp;gt;. This returns an object of type &amp;lt;code&amp;gt;CoreTable&amp;lt;/code&amp;gt;, which has a property &amp;lt;code&amp;gt;Rows&amp;lt;/code&amp;gt;, through which one can retrieve data. An example is shown here.&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(new string[] {&amp;quot;Employee&amp;quot;}); // Load Model&lt;br /&gt;
CoreTable employeeTable = Model.GetTable&amp;lt;Employee&amp;gt;(); // Get Table from Model&lt;br /&gt;
&lt;br /&gt;
// Iterate through the rows&lt;br /&gt;
foreach(CoreRow row in employeeTable.Rows){&lt;br /&gt;
    // Convert the row to an Employee. This is not necessary, and the data can also be retrieved with row[ColumnName] or row.ToDictionary()[ColumnName]&lt;br /&gt;
    var employee = row.ToObject&amp;lt;Employee&amp;gt;();&lt;br /&gt;
    &amp;lt;p&amp;gt;@employee.ID: @employee.Name&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Partial Templates===&lt;br /&gt;
Sometimes it is useful to write a &#039;&#039;partial template&#039;&#039;, that is, one that only represents part of a web page and is used elsewhere, e.g. a header which is used site-wide. This is possible. First, create a web template with the Visible property unchecked. Leave the DataModel blank, since that is only useful when loading the page from an HTTP request. For this example, give it the Slug &#039;&#039;header&#039;&#039;, and set its content to be:&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;header&amp;gt;&lt;br /&gt;
    &amp;lt;h1&amp;gt;The Title&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;Then, within the main page, call &amp;lt;code&amp;gt;@Raw(WebHandler.RunTemplate(WebDatabaseInterface.GetWebTemplateBySlug(&amp;quot;header&amp;quot;), Model))&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Through this, the header will be inserted into the main page. Note that @Raw is required, for otherwise the retrieved HTML will be displayed as plain text, rather than interpreted as HTML.&lt;br /&gt;
&lt;br /&gt;
This method can also be used for loading stylesheets which must load styling information non-statically. Simply save the stylesheet as a WebTemplate instead of as a WebStyle, and the load it as a template.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Web_Template&amp;diff=152</id>
		<title>Web Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Web_Template&amp;diff=152"/>
		<updated>2022-12-16T02:12:10Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Fields */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Web Templates are the manner in which the Web Engine interfaces with a user, written in HTML with C# support using the Razor templating engine. Upon receiving a request from a user, the WebEngine finds the template that is required and then executes it, recompiling if changes have been made.&lt;br /&gt;
==Fields==&lt;br /&gt;
&lt;br /&gt;
===DataModel===&lt;br /&gt;
&lt;br /&gt;
The DataModel field is a name of an entity type, such as Equipment or Employee, which specifies the specific data to load for the page template. For example, if you are writing a page which lists employees, it is useful to preload the data necessary - this is done by setting DataModel to &amp;quot;Employee&amp;quot;. This field is optional.&lt;br /&gt;
&lt;br /&gt;
===Slug ===&lt;br /&gt;
&lt;br /&gt;
The Slug field denotes the name of the page itself, intended to be a short text field which describes the function of the page. Note that it cannot contain any slashes (&#039;/&#039;, &#039;\&#039;), and should use only characters which are URL-safe; when in doubt, stick to just numbers and letters.&lt;br /&gt;
&lt;br /&gt;
The DataModel and slug fields combine to form a path to the page, with the form &#039;&#039;www.domain.com/v1/DataModel/Slug?id=XXXXXXXX-XXXX-XXXX-XXXXXXXX&#039;&#039;. If the DataModel field is empty, then the URL is simply &#039;&#039;www.domain.com/v1/Slug&#039;&#039;. This allows you to create pages which do not have to be tied to a specific entity. If a page has a DataModel and the id query does not match any page, then a 404 Not Found is returned to the user.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
The Description field is a non-functional field which allows you to add a description to the template - this is not necessary, but can be useful as a reference.&lt;br /&gt;
&lt;br /&gt;
=== Template ===&lt;br /&gt;
&lt;br /&gt;
The source code for the template, which is in the Razor syntax - a mix of C# and HTML.&lt;br /&gt;
&lt;br /&gt;
===Visible===&lt;br /&gt;
&lt;br /&gt;
The Visible field denotes whether the page is accessibly via a URL - if it is not visible, then a 404 Not Found is returned when trying to access it - it is as if it didn&#039;t exist. Use this if you want to disable a page or if the template is only relevant in the context of other templates - see [[PRS/WebTemplate#Partial%20Templates|Partial Templates]]&lt;br /&gt;
&lt;br /&gt;
=== Root URL ===&lt;br /&gt;
&lt;br /&gt;
This field is default to false. It defines whether the URL of the page is a root URL, or whether it is prefixed by &amp;quot;v1/&amp;quot; (The default is the prefix). We have the prefix so that we can add our own endpoints to the Web Engine, such as the &amp;quot;/login&amp;quot; endpoint, without clashing with any endpoints that you have created. However, if you do want to remove the prefix, untick this box. In order to allow you to choose a URL which is guaranteed to never clash with our own endpoints, you can start your [[#Slug|slug]] with a capital letter - we reserve all lowercase letter slugs that are not prefixed with &amp;quot;v1/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Tick this box at your own risk, since if we add an endpoint in future that has the same name as a page you have added, your page will effectively become inaccessible.&lt;br /&gt;
&lt;br /&gt;
==Writing a Template==&lt;br /&gt;
To write a template, you should be familiar with HTML, CSS and JavaScript as well as C#, which is used for non-static content.&lt;br /&gt;
===Basics===&lt;br /&gt;
At its base, a template is an HTML file - that is, that one can write a static web page, without the use of C#, and it would display as it would in a browser. Note that this has no means of accessing any resources outside of the page, so any styling with CSS must be embedded.&lt;br /&gt;
&lt;br /&gt;
The page is then able to contain embedded C# code, using the Razor syntax. Roughly, one can embed a C# expression by preceding it with an &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt;, e.g. &amp;lt;code&amp;gt;@employee.Name&amp;lt;/code&amp;gt;. If the expression is too complex, surround it with parentheses, &amp;lt;code&amp;gt;@(GenericMethod&amp;lt;string&amp;gt;())&amp;lt;/code&amp;gt;. To execute blocks of code, use &amp;lt;code&amp;gt;@{ ... }&amp;lt;/code&amp;gt;, and for control structures like &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;foreach&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; should come before the keyword, e.g. &amp;lt;code&amp;gt;@if(condition){ ... }&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Within a block of code, one can return to HTML simply by using HTML tags, e.g.&amp;lt;pre&amp;gt;&lt;br /&gt;
@if(condition){&lt;br /&gt;
    &amp;lt;p&amp;gt;Condition is true&amp;lt;/p&amp;gt;&lt;br /&gt;
} else {&lt;br /&gt;
    string error = &amp;quot;Condition is false&amp;quot;;&lt;br /&gt;
    &amp;lt;p&amp;gt;@error&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Styling===&lt;br /&gt;
To add a stylesheet, you can create a [[PRS/WebStyle|WebStyle]], which can be loaded with &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(string code)&amp;lt;/code&amp;gt;, which retrieves the content of that stylesheet as raw text. Thus, to use a WebStyle with the code &amp;quot;MAIN&amp;quot;, one would put in the &amp;lt;code&amp;gt;&amp;amp;lt;head&amp;amp;gt;&amp;lt;/code&amp;gt; tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;style&amp;amp;gt; @(WebDatabaseInterface.GetStylesheet(&amp;quot;MAIN&amp;quot;).Style) &amp;amp;lt;/style&amp;amp;gt;&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This would load that stylesheet into the current web page.&lt;br /&gt;
&lt;br /&gt;
If multiple stylesheets need to be loaded, consider using &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheets(params string[] stylesheetCodes)&amp;lt;/code&amp;gt;, which gets all the stylesheets in request.&lt;br /&gt;
===Using DataModels===&lt;br /&gt;
The Razor engine provides to each template page a parameter called &amp;lt;code&amp;gt;Model&amp;lt;/code&amp;gt;, by which data can be retrieved. By default, it contains no data except for a table called &amp;quot;User&amp;quot;, which contains the current user. To load the required data for the page, a call to &amp;lt;code&amp;gt;Model.LoadModel(string[] requiredTables, params IDataModelQueryDef[] requiredQueries)&amp;lt;/code&amp;gt; must be executed.&lt;br /&gt;
&lt;br /&gt;
The first parameter, &amp;lt;code&amp;gt;requiredTables&amp;lt;/code&amp;gt;, specifies which tables should be loaded. By default, &amp;lt;code&amp;gt;LoadModel&amp;lt;/code&amp;gt; loads nothing. In general, the CompanyInformation, CompanyLogo and the current entity are useful to load, so a call could look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Model.LoadModel(new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;})&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second parameter specifies a way to narrow the load of the data, preventing unnecessary data from being loaded. For example, if one only requires the ID and Name fields of an employee, one might call:&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(&lt;br /&gt;
    new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;},&lt;br /&gt;
    new DataModelQueryDef&amp;lt;Employee&amp;gt;(&lt;br /&gt;
        null,&lt;br /&gt;
        new Columns&amp;lt;Employee&amp;gt;(x =&amp;gt; x.ID).Add(x =&amp;gt; x.Name),&lt;br /&gt;
        null)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default, all columns in the database are loaded, so this is a way to drastically reduce the amount of data loaded. (The other two fields, set to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, specify a filter and sort order for the retrieved data.)&lt;br /&gt;
====Retrieving Data====&lt;br /&gt;
To get a table that has been loaded, use &amp;lt;code&amp;gt;Model.GetTable&amp;lt;T&amp;gt;(alias)&amp;lt;/code&amp;gt;. This returns an object of type &amp;lt;code&amp;gt;CoreTable&amp;lt;/code&amp;gt;, which has a property &amp;lt;code&amp;gt;Rows&amp;lt;/code&amp;gt;, through which one can retrieve data. An example is shown here.&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(new string[] {&amp;quot;Employee&amp;quot;}); // Load Model&lt;br /&gt;
CoreTable employeeTable = Model.GetTable&amp;lt;Employee&amp;gt;(); // Get Table from Model&lt;br /&gt;
&lt;br /&gt;
// Iterate through the rows&lt;br /&gt;
foreach(CoreRow row in employeeTable.Rows){&lt;br /&gt;
    // Convert the row to an Employee. This is not necessary, and the data can also be retrieved with row[ColumnName] or row.ToDictionary()[ColumnName]&lt;br /&gt;
    var employee = row.ToObject&amp;lt;Employee&amp;gt;();&lt;br /&gt;
    &amp;lt;p&amp;gt;@employee.ID: @employee.Name&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Partial Templates===&lt;br /&gt;
Sometimes it is useful to write a &#039;&#039;partial template&#039;&#039;, that is, one that only represents part of a web page and is used elsewhere, e.g. a header which is used site-wide. This is possible. First, create a web template with the Visible property unchecked. Leave the DataModel blank, since that is only useful when loading the page from an HTTP request. For this example, give it the Slug &#039;&#039;header&#039;&#039;, and set its content to be:&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;header&amp;gt;&lt;br /&gt;
    &amp;lt;h1&amp;gt;The Title&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;Then, within the main page, call &amp;lt;code&amp;gt;@Raw(WebHandler.RunTemplate(WebDatabaseInterface.GetWebTemplateBySlug(&amp;quot;header&amp;quot;), Model))&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Through this, the header will be inserted into the main page. Note that @Raw is required, for otherwise the retrieved HTML will be displayed as plain text, rather than interpreted as HTML.&lt;br /&gt;
&lt;br /&gt;
This method can also be used for loading stylesheets which must load styling information non-statically. Simply save the stylesheet as a WebTemplate instead of as a WebStyle, and the load it as a template.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=151</id>
		<title>Report Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=151"/>
		<updated>2022-12-16T02:05:30Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Using Data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Report Template system gives the ability to generate reports based on the data with PRS, assisting in displaying and reporting on whatever is required. All main panels within PRS allow for reports, and each can have as many reports as is required.&lt;br /&gt;
&lt;br /&gt;
== Creating a Report ==&lt;br /&gt;
[[File:Report Manager Button.png|thumb|310x310px|The button to open the Report Manager]]&lt;br /&gt;
To create a report, you will need the &amp;quot;Design Reports&amp;quot; [[Security Token]].&lt;br /&gt;
Then, simply navigate to any screen on PRS, and click the little arrow in the ribbon bar at the top, as displayed in the picture. This will open up a new grid, from which you can create new report templates. Each report template in this grid acts as a &amp;quot;template&amp;quot; for the report; it tells PRS how to display the data. To create a new report, simply click the &amp;quot;+&amp;quot; button down the bottom, and fill in the required fields.&lt;br /&gt;
&lt;br /&gt;
=== Fields ===&lt;br /&gt;
&lt;br /&gt;
==== Name ====&lt;br /&gt;
The name is the name of the report, displayed in the main ribbon of PRS. It should be descriptive about what data the report displays.&lt;br /&gt;
&lt;br /&gt;
==== Visible ====&lt;br /&gt;
Determines whether the report should be visible in PRS. If this is not checked, there will be no way to generate the report. This should be used when you have old reports that are no longer necessary, but you don&#039;t want to delete them in case you need them again, or, if you are currently working on a report&#039;s design and don&#039;t want it to be visible yet.&lt;br /&gt;
&lt;br /&gt;
==== All Records / Selected Records ====&lt;br /&gt;
These fields determine what data should be used in the report. Most panels in PRS have a way to select data, and these fields determine whether all data in PRS should be used, or just the records that have been selected. If neither are selected, the report will not be able to be generated. If both are selected, there will be an option to choose which one when generating the report later on.&lt;br /&gt;
&lt;br /&gt;
=== Loading &amp;amp; Saving ===&lt;br /&gt;
On the left hand side of the report grid, there are two buttons for loading and saving reports from/to files. This allows you to take a report template and reload it somewhere else. Note that this is prone to errors, since a report is intrinsically tied to the type of data that is being loaded; hence, if you export a report for [[Kanban|Tasks]] and then import it for [[Job|Projects]], there will most likely be errors, since the data that represents a Job is different from that of a Task. Hence, this is not recommended unless you know what you are doing.&lt;br /&gt;
&lt;br /&gt;
== Report Design ==&lt;br /&gt;
&lt;br /&gt;
Reports can be designed from two places in PRS - first, from the Report Manager, where you create new reports (See [[#Creating a Report|Creating a Report]]). On the right hand-side of this grid, there is a pencil icon, which, if clicked, brings up the report designer.&lt;br /&gt;
&lt;br /&gt;
The other place that reports can be designed from is the preview window, brought up by clicking on the report in the ribbon (See [[#Printing Reports|Printing Reports]]). From the preview window, click the pencil icon in the top right, and this opens the designer. If designed this way, there is also data pre-loaded into the report, since you have previewed the report. This means that you can design the report and then preview with data already loaded, assisting you to design based on how the end product will look with data.&lt;br /&gt;
&lt;br /&gt;
PRS uses the [https://www.fast-report.com/en/ FastReport] engine and designer for its reporting system, and so details on how to use the report designer can be found on their [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/Fundamentals.html online documentation]. That being said, there are several important points that can be mentioned here as well.&lt;br /&gt;
&lt;br /&gt;
=== Previewing ===&lt;br /&gt;
&lt;br /&gt;
The report can be previewed from the designer. Click on &amp;quot;File -&amp;gt; Preview...&amp;quot; This will preview the current report as you&#039;ve designed it. Note that this does not save the report, so don&#039;t forget to return to the designer and hit the save button to ensure your changes are committed. Also, if you loaded the report from the PRS ribbon, instead of the report manager (see [[#Printing Reports|Printing Reports]]), then this preview will use the data that was loaded when printing the report.&lt;br /&gt;
[[File:Choose data.png|thumb|Choose Report Data]]&lt;br /&gt;
&lt;br /&gt;
=== Selecting Data ===&lt;br /&gt;
&lt;br /&gt;
The data to be loaded into the report comes in the form of tables; each table corresponds to a specific &amp;quot;type&amp;quot; of data. An &amp;quot;Employee&amp;quot; table will contain data for [[Employee|Employees]], and an &amp;quot;Equipment&amp;quot; table contains data about [[Equipment]]. A few of the table names are slightly different than what they might appear in PRS, e.g. the table for [[Task|Tasks]] is named &amp;quot;Kanban&amp;quot;. So when you want to generate a report on your tasks, the data you will need will be in the &amp;quot;Kanban&amp;quot; table.&lt;br /&gt;
&lt;br /&gt;
Each table has a number of columns which map to the individual properties of an object, so &amp;quot;Kanban&amp;quot; has columns for its &amp;quot;Number&amp;quot;, its &amp;quot;Title&amp;quot;, and many others. Each row of the table is a specific object.&lt;br /&gt;
&lt;br /&gt;
It is important to tell PRS what data you need - there exists a vast number of tables that PRS knows how to load, but you will not want PRS to load all this data, since that can take a while. To choose the data you want to report on, navigate to &amp;quot;Data -&amp;gt; Choose Report Data...&amp;quot;. This will bring up a menu from which you can select a number of tables to load data for. Several of these are loaded by default, such as the &amp;quot;CompanyInformation&amp;quot; table, &amp;quot;CompanyLogo&amp;quot; table and the table related to the specific data - generating a report for tasks will automatically load the &amp;quot;Kanban&amp;quot; table. Other tables that &#039;&#039;can&#039;&#039; be loaded (but are not by default) are those that are related to the main object. So, since tasks can have associated equipment items, there is also a &amp;quot;Kanban_Equipment&amp;quot; table. The &amp;quot;Kanban_&amp;quot; prefix represents the fact that this is, in a way, a &amp;quot;child table&amp;quot; of &amp;quot;Kanban&amp;quot; - there is a link between the tables. The report designer knows about these relationships between the tables, so the associated relationships can be modelled using the report designer&#039;s concepts of Detail Bands (see the [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/DataBand/MasterDetailRelations.html documentation]). In order to tell PRS to also load the equipment associated with the tasks, check the little box next to &amp;quot;Kanban_Equipment&amp;quot;, so that it displays a tick. Then, next time you preview the report (by closing and re-opening the report), PRS will also load the data required.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;quot;Kanban_Equipment&amp;quot; table does not load every piece of equipment in PRS - it only loads the equipment items that are related to the tasks that you selected - if only one task was selected to generate the report, then the &amp;quot;Kanban_Equipment&amp;quot; table will have at most &#039;&#039;one&#039;&#039; equipment item, since only one piece of equipment is able to be attached to a task.&lt;br /&gt;
&lt;br /&gt;
You can also select particular columns from the data selection window, but at this stage this does not cause less data to be loaded - it just prevents it being displayed in the various windows in the report designer and thus removes from view unnecessary fields that clutter up the screen.&lt;br /&gt;
&lt;br /&gt;
=== Using Data ===&lt;br /&gt;
[[File:Data window.png|thumb|216x216px|Data window]]&lt;br /&gt;
On the right-hand side of the designer is a &amp;quot;Data&amp;quot; window (if this is not present, click on &amp;quot;View -&amp;gt; Data&amp;quot;). From here you can get data to be displayed in the report. Expand the &amp;quot;Data Sources&amp;quot; menu and you will see a list of the tables you have loaded. Expand any one of them, and then you will see a collection of fields you can select from. To use a field, click and drag from this window over onto the report. For many types of data, this will automatically create a label filled with a placeholder that tells the report engine that you intend to use a data field here. (The syntax for this placeholder is the table name, followed by a dot, followed by the field name, and surrounded in square brackets - e.g., &amp;amp;lsqb;Kanban.Title&amp;amp;rsqb;&lt;br /&gt;
[[File:Data selection arrow.png|left|thumb|110x110px|Data selection arrow]]&lt;br /&gt;
Also, some data is automatically recognised as an image. For example, if you expand the &amp;quot;CompanyLogo&amp;quot; table, and drag the &amp;quot;Data&amp;quot; field onto the report, it will render as an image using the logo of your company (set in the [[Company Information]] screen). Additionally, dates are recognised as dates, and check boxes (such as the &amp;quot;Private&amp;quot; field for tasks) are rendered as check boxes.&lt;br /&gt;
&lt;br /&gt;
The data fields can also be set by clicking the little arrow that appears in the top-right of report objects when hovering over them, as shown in the image. If you click on that, you can select a data field for the object (note that the associated data band must be set, see [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/DataBand/SimpleListReport/PrintDataRows.html the documentation]).&lt;br /&gt;
&lt;br /&gt;
== Printing Reports ==&lt;br /&gt;
&lt;br /&gt;
Once you have created and designed a report, it is now ready to be generated/printed. In PRS, navigate to the panel where you created the report, and, if the report was set to [[#Visible|Visible]], it will now appear in the bar at the top. This will be visible to anyone with the &amp;quot;Print Reports&amp;quot; [[Security Token]], and by clicking on the report, the relevant data will be assembled, and the report generated from the data.&lt;br /&gt;
&lt;br /&gt;
Generating the report will open the report preview window, from which you view, print, or save to PDF. Additionally, if you have the &amp;quot;Design Reports&amp;quot; [[Security Token]], then there will also be a pencil icon, which you can click to edit the report in the designer, allowing for a quick backwards and forwards between the design and preview modes. Additionally, since generating the report allows means there is now data to print from, it is often easier to design a report by first printing it to give it some data to work with, and then designing from the preview window, allowing you to see the changes that you make by clicking &amp;quot;Preview&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=File:Report_Manager_Button.png&amp;diff=150</id>
		<title>File:Report Manager Button.png</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=File:Report_Manager_Button.png&amp;diff=150"/>
		<updated>2022-12-16T02:04:41Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Button to open the report manager&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=File:Choose_data.png&amp;diff=149</id>
		<title>File:Choose data.png</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=File:Choose_data.png&amp;diff=149"/>
		<updated>2022-12-16T01:55:52Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Choose Report Data window&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=File:Data_window.png&amp;diff=148</id>
		<title>File:Data window.png</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=File:Data_window.png&amp;diff=148"/>
		<updated>2022-12-16T01:53:27Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The window displaying the data sources for the report&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=File:Data_selection_arrow.png&amp;diff=147</id>
		<title>File:Data selection arrow.png</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=File:Data_selection_arrow.png&amp;diff=147"/>
		<updated>2022-12-16T01:52:00Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Click this arrow to select the data for a label or other report object.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=146</id>
		<title>Report Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=146"/>
		<updated>2022-12-16T01:50:18Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Report Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Report Template system gives the ability to generate reports based on the data with PRS, assisting in displaying and reporting on whatever is required. All main panels within PRS allow for reports, and each can have as many reports as is required.&lt;br /&gt;
&lt;br /&gt;
== Creating a Report ==&lt;br /&gt;
&lt;br /&gt;
To create a report, you will need the &amp;quot;Design Reports&amp;quot; [[Security Token]].&lt;br /&gt;
Then, simply navigate to any screen on PRS, and click the little arrow in the ribbon bar at the top, as displayed in the picture. This will open up a new grid, from which you can create new report templates. Each report template in this grid acts as a &amp;quot;template&amp;quot; for the report; it tells PRS how to display the data. To create a new report, simply click the &amp;quot;+&amp;quot; button down the bottom, and fill in the required fields.&lt;br /&gt;
&lt;br /&gt;
=== Fields ===&lt;br /&gt;
&lt;br /&gt;
==== Name ====&lt;br /&gt;
The name is the name of the report, displayed in the main ribbon of PRS. It should be descriptive about what data the report displays.&lt;br /&gt;
&lt;br /&gt;
==== Visible ====&lt;br /&gt;
Determines whether the report should be visible in PRS. If this is not checked, there will be no way to generate the report. This should be used when you have old reports that are no longer necessary, but you don&#039;t want to delete them in case you need them again, or, if you are currently working on a report&#039;s design and don&#039;t want it to be visible yet.&lt;br /&gt;
&lt;br /&gt;
==== All Records / Selected Records ====&lt;br /&gt;
These fields determine what data should be used in the report. Most panels in PRS have a way to select data, and these fields determine whether all data in PRS should be used, or just the records that have been selected. If neither are selected, the report will not be able to be generated. If both are selected, there will be an option to choose which one when generating the report later on.&lt;br /&gt;
&lt;br /&gt;
=== Loading &amp;amp; Saving ===&lt;br /&gt;
On the left hand side of the report grid, there are two buttons for loading and saving reports from/to files. This allows you to take a report template and reload it somewhere else. Note that this is prone to errors, since a report is intrinsically tied to the type of data that is being loaded; hence, if you export a report for [[Kanban|Tasks]] and then import it for [[Job|Projects]], there will most likely be errors, since the data that represents a Job is different from that of a Task. Hence, this is not recommended unless you know what you are doing.&lt;br /&gt;
&lt;br /&gt;
== Report Design ==&lt;br /&gt;
&lt;br /&gt;
Reports can be designed from two places in PRS - first, from the Report Manager, where you create new reports (See [[#Creating a Report|Creating a Report]]). On the right hand-side of this grid, there is a pencil icon, which, if clicked, brings up the report designer.&lt;br /&gt;
&lt;br /&gt;
The other place that reports can be designed from is the preview window, brought up by clicking on the report in the ribbon (See [[#Printing Reports|Printing Reports]]). From the preview window, click the pencil icon in the top right, and this opens the designer. If designed this way, there is also data pre-loaded into the report, since you have previewed the report. This means that you can design the report and then preview with data already loaded, assisting you to design based on how the end product will look with data.&lt;br /&gt;
&lt;br /&gt;
PRS uses the [https://www.fast-report.com/en/ FastReport] engine and designer for its reporting system, and so details on how to use the report designer can be found on their [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/Fundamentals.html online documentation]. That being said, there are several important points that can be mentioned here as well.&lt;br /&gt;
&lt;br /&gt;
=== Previewing ===&lt;br /&gt;
&lt;br /&gt;
The report can be previewed from the designer. Click on &amp;quot;File -&amp;gt; Preview...&amp;quot; This will preview the current report as you&#039;ve designed it. Note that this does not save the report, so don&#039;t forget to return to the designer and hit the save button to ensure your changes are committed. Also, if you loaded the report from the PRS ribbon, instead of the report manager (see [[#Printing Reports|Printing Reports]]), then this preview will use the data that was loaded when printing the report.&lt;br /&gt;
&lt;br /&gt;
=== Selecting Data ===&lt;br /&gt;
&lt;br /&gt;
The data to be loaded into the report comes in the form of tables; each table corresponds to a specific &amp;quot;type&amp;quot; of data. An &amp;quot;Employee&amp;quot; table will contain data for [[Employee|Employees]], and an &amp;quot;Equipment&amp;quot; table contains data about [[Equipment]]. A few of the table names are slightly different than what they might appear in PRS, e.g. the table for [[Task|Tasks]] is named &amp;quot;Kanban&amp;quot;. So when you want to generate a report on your tasks, the data you will need will be in the &amp;quot;Kanban&amp;quot; table.&lt;br /&gt;
&lt;br /&gt;
Each table has a number of columns which map to the individual properties of an object, so &amp;quot;Kanban&amp;quot; has columns for its &amp;quot;Number&amp;quot;, its &amp;quot;Title&amp;quot;, and many others. Each row of the table is a specific object.&lt;br /&gt;
&lt;br /&gt;
It is important to tell PRS what data you need - there exists a vast number of tables that PRS knows how to load, but you will not want PRS to load all this data, since that can take a while. To choose the data you want to report on, navigate to &amp;quot;Data -&amp;gt; Choose Report Data...&amp;quot;. This will bring up a menu from which you can select a number of tables to load data for. Several of these are loaded by default, such as the &amp;quot;CompanyInformation&amp;quot; table, &amp;quot;CompanyLogo&amp;quot; table and the table related to the specific data - generating a report for tasks will automatically load the &amp;quot;Kanban&amp;quot; table. Other tables that &#039;&#039;can&#039;&#039; be loaded (but are not by default) are those that are related to the main object. So, since tasks can have associated equipment items, there is also a &amp;quot;Kanban_Equipment&amp;quot; table. The &amp;quot;Kanban_&amp;quot; prefix represents the fact that this is, in a way, a &amp;quot;child table&amp;quot; of &amp;quot;Kanban&amp;quot; - there is a link between the tables. The report designer knows about these relationships between the tables, so the associated relationships can be modelled using the report designer&#039;s concepts of Detail Bands (see the [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/DataBand/MasterDetailRelations.html documentation]). In order to tell PRS to also load the equipment associated with the tasks, check the little box next to &amp;quot;Kanban_Equipment&amp;quot;, so that it displays a tick. Then, next time you preview the report (by closing and re-opening the report), PRS will also load the data required.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;quot;Kanban_Equipment&amp;quot; table does not load every piece of equipment in PRS - it only loads the equipment items that are related to the tasks that you selected - if only one task was selected to generate the report, then the &amp;quot;Kanban_Equipment&amp;quot; table will have at most &#039;&#039;one&#039;&#039; equipment item, since only one piece of equipment is able to be attached to a task.&lt;br /&gt;
&lt;br /&gt;
You can also select particular columns from the data selection window, but at this stage this does not cause less data to be loaded - it just prevents it being displayed in the various windows in the report designer and thus removes from view unnecessary fields that clutter up the screen.&lt;br /&gt;
&lt;br /&gt;
=== Using Data ===&lt;br /&gt;
&lt;br /&gt;
On the right-hand side of the designer is a &amp;quot;Data&amp;quot; window (if this is not present, click on &amp;quot;View -&amp;gt; Data&amp;quot;). From here you can get data to be displayed in the report. Expand the &amp;quot;Data Sources&amp;quot; menu and you will see a list of the tables you have loaded. Expand any one of them, and then you will see a collection of fields you can select from. To use a field, click and drag from this window over onto the report. For many types of data, this will automatically create a label filled with a placeholder that tells the report engine that you intend to use a data field here. (The syntax for this placeholder is the table name, followed by a dot, followed by the field name, and surrounded in square brackets - e.g., &amp;amp;lsqb;Kanban.Title&amp;amp;rsqb;&lt;br /&gt;
&lt;br /&gt;
Also, some data is automatically recognised as an image. For example, if you expand the &amp;quot;CompanyLogo&amp;quot; table, and drag the &amp;quot;Data&amp;quot; field onto the report, it will render as an image using the logo of your company (set in the [[Company Information]] screen). Additionally, dates are recognised as dates, and check boxes (such as the &amp;quot;Private&amp;quot; field for tasks) are rendered as check boxes.&lt;br /&gt;
&lt;br /&gt;
The data fields can also be set by clicking the little arrow that appears in the top-right of report objects when hovering over them, as shown in the image. If you click on that, you can select a data field for the object (note that the associated data band must be set, see [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/DataBand/SimpleListReport/PrintDataRows.html the documentation]).&lt;br /&gt;
&lt;br /&gt;
== Printing Reports ==&lt;br /&gt;
&lt;br /&gt;
Once you have created and designed a report, it is now ready to be generated/printed. In PRS, navigate to the panel where you created the report, and, if the report was set to [[#Visible|Visible]], it will now appear in the bar at the top. This will be visible to anyone with the &amp;quot;Print Reports&amp;quot; [[Security Token]], and by clicking on the report, the relevant data will be assembled, and the report generated from the data.&lt;br /&gt;
&lt;br /&gt;
Generating the report will open the report preview window, from which you view, print, or save to PDF. Additionally, if you have the &amp;quot;Design Reports&amp;quot; [[Security Token]], then there will also be a pencil icon, which you can click to edit the report in the designer, allowing for a quick backwards and forwards between the design and preview modes. Additionally, since generating the report allows means there is now data to print from, it is often easier to design a report by first printing it to give it some data to work with, and then designing from the preview window, allowing you to see the changes that you make by clicking &amp;quot;Preview&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=145</id>
		<title>Report Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=145"/>
		<updated>2022-12-16T01:38:41Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Report Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Report Template system gives the ability to generate reports based on the data with PRS, assisting in displaying and reporting on whatever is required. All main panels within PRS allow for reports, and each can have as many reports as is required.&lt;br /&gt;
&lt;br /&gt;
== Creating a Report ==&lt;br /&gt;
&lt;br /&gt;
To create a report, you will need the &amp;quot;Design Reports&amp;quot; [[Security Token]].&lt;br /&gt;
Then, simply navigate to any screen on PRS, and click the little arrow in the ribbon bar at the top, as displayed in the picture. This will open up a new grid, from which you can create new report templates. Each report template in this grid acts as a &amp;quot;template&amp;quot; for the report; it tells PRS how to display the data. To create a new report, simply click the &amp;quot;+&amp;quot; button down the bottom, and fill in the required fields.&lt;br /&gt;
&lt;br /&gt;
=== Fields ===&lt;br /&gt;
&lt;br /&gt;
==== Name ====&lt;br /&gt;
The name is the name of the report, displayed in the main ribbon of PRS. It should be descriptive about what data the report displays.&lt;br /&gt;
&lt;br /&gt;
==== Visible ====&lt;br /&gt;
Determines whether the report should be visible in PRS. If this is not checked, there will be no way to generate the report. This should be used when you have old reports that are no longer necessary, but you don&#039;t want to delete them in case you need them again, or, if you are currently working on a report&#039;s design and don&#039;t want it to be visible yet.&lt;br /&gt;
&lt;br /&gt;
==== All Records / Selected Records ====&lt;br /&gt;
These fields determine what data should be used in the report. Most panels in PRS have a way to select data, and these fields determine whether all data in PRS should be used, or just the records that have been selected. If neither are selected, the report will not be able to be generated. If both are selected, there will be an option to choose which one when generating the report later on.&lt;br /&gt;
&lt;br /&gt;
=== Loading &amp;amp; Saving ===&lt;br /&gt;
On the left hand side of the report grid, there are two buttons for loading and saving reports from/to files. This allows you to take a report template and reload it somewhere else. Note that this is prone to errors, since a report is intrinsically tied to the type of data that is being loaded; hence, if you export a report for [[Kanban|Tasks]] and then import it for [[Job|Projects]], there will most likely be errors, since the data that represents a Job is different from that of a Task. Hence, this is not recommended unless you know what you are doing.&lt;br /&gt;
&lt;br /&gt;
== Report Design ==&lt;br /&gt;
&lt;br /&gt;
Reports can be designed from two places in PRS - first, from the Report Manager, where you create new reports (See [[#Creating a Report|Creating a Report]]). On the right hand-side of this grid, there is a pencil icon, which, if clicked, brings up the report designer.&lt;br /&gt;
&lt;br /&gt;
The other place that reports can be designed from is the preview window, brought up by clicking on the report in the ribbon (See [[#Printing Reports|Printing Reports]]). From the preview window, click the pencil icon in the top right, and this opens the designer. If designed this way, there is also data pre-loaded into the report, since you have previewed the report. This means that you can design the report and then preview with data already loaded, assisting you to design based on how the end product will look with data.&lt;br /&gt;
&lt;br /&gt;
PRS uses the [https://www.fast-report.com/en/ FastReport] engine and designer for its reporting system, and so details on how to use the report designer can be found on their [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/Fundamentals.html online documentation]. That being said, there are several important points that can be mentioned here as well.&lt;br /&gt;
&lt;br /&gt;
=== Previewing ===&lt;br /&gt;
&lt;br /&gt;
The report can be previewed from the designer. Click on &amp;quot;File -&amp;gt; Preview...&amp;quot; This will preview the current report as you&#039;ve designed it. Note that this does not save the report, so don&#039;t forget to return to the designer and hit the save button to ensure your changes are committed. Also, if you loaded the report from the PRS ribbon, instead of the report manager (see [[#Printing Reports|Printing Reports]]), then this preview will use the data that was loaded when printing the report.&lt;br /&gt;
&lt;br /&gt;
=== Selecting Data ===&lt;br /&gt;
&lt;br /&gt;
The data to be loaded into the report comes in the form of tables; each table corresponds to a specific &amp;quot;type&amp;quot; of data. An &amp;quot;Employee&amp;quot; table will contain data for [[Employee|Employees]], and an &amp;quot;Equipment&amp;quot; table contains data about [[Equipment]]. A few of the table names are slightly different than what they might appear in PRS, e.g. the table for [[Task|Tasks]] is named &amp;quot;Kanban&amp;quot;. So when you want to generate a report on your tasks, the data you will need will be in the &amp;quot;Kanban&amp;quot; table.&lt;br /&gt;
&lt;br /&gt;
Each table has a number of columns which map to the individual properties of an object, so &amp;quot;Kanban&amp;quot; has columns for its &amp;quot;Number&amp;quot;, its &amp;quot;Title&amp;quot;, and many others. Each row of the table is a specific object.&lt;br /&gt;
&lt;br /&gt;
It is important to tell PRS what data you need - there exists a vast number of tables that PRS knows how to load, but you will not want PRS to load all this data, since that can take a while. To choose the data you want to report on, navigate to &amp;quot;Data -&amp;gt; Choose Report Data...&amp;quot;. This will bring up a menu from which you can select a number of tables to load data for. Several of these are loaded by default, such as the &amp;quot;CompanyInformation&amp;quot; table, &amp;quot;CompanyLogo&amp;quot; table and the table related to the specific data - generating a report for tasks will automatically load the &amp;quot;Kanban&amp;quot; table. Other tables that &#039;&#039;can&#039;&#039; be loaded (but are not by default) are those that are related to the main object. So, since tasks can have associated equipment items, there is also a &amp;quot;Kanban_Equipment&amp;quot; table. The &amp;quot;Kanban_&amp;quot; prefix represents the fact that this is, in a way, a &amp;quot;child table&amp;quot; of &amp;quot;Kanban&amp;quot; - there is a link between the tables. The report designer knows about these relationships between the tables, so the associated relationships can be modelled using the report designer&#039;s concepts of Detail Bands (see the [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/DataBand/MasterDetailRelations.html documentation]). In order to tell PRS to also load the equipment associated with the tasks, check the little box next to &amp;quot;Kanban_Equipment&amp;quot;, so that it displays a tick. Then, next time you preview the report, PRS will also load the data required.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;quot;Kanban_Equipment&amp;quot; table does not load every piece of equipment in PRS - it only loads the equipment items that are related to the tasks that you selected - if only one task was selected to generate the report, then the &amp;quot;Kanban_Equipment&amp;quot; table will have at most &#039;&#039;one&#039;&#039; equipment item, since only one piece of equipment is able to be attached to a task.&lt;br /&gt;
&lt;br /&gt;
You can also select particular columns from the data selection window, but at this stage this does not cause less data to be loaded - it just prevents it being displayed in the various windows in the report designer and thus removes from view unnecessary fields that clutter up the screen.&lt;br /&gt;
&lt;br /&gt;
== Printing Reports ==&lt;br /&gt;
&lt;br /&gt;
Once you have created and designed a report, it is now ready to be generated/printed. In PRS, navigate to the panel where you created the report, and, if the report was set to [[#Visible|Visible]], it will now appear in the bar at the top. This will be visible to anyone with the &amp;quot;Print Reports&amp;quot; [[Security Token]], and by clicking on the report, the relevant data will be assembled, and the report generated from the data.&lt;br /&gt;
&lt;br /&gt;
Generating the report will open the report preview window, from which you view, print, or save to PDF. Additionally, if you have the &amp;quot;Design Reports&amp;quot; [[Security Token]], then there will also be a pencil icon, which you can click to edit the report in the designer, allowing for a quick backwards and forwards between the design and preview modes. Additionally, since generating the report allows means there is now data to print from, it is often easier to design a report by first printing it to give it some data to work with, and then designing from the preview window, allowing you to see the changes that you make by clicking &amp;quot;Preview&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=144</id>
		<title>Report Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=144"/>
		<updated>2022-12-16T01:38:23Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Report Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Report Template system gives the ability to generate reports based on the data with PRS, assisting in displaying and reporting on whatever is required. All main panels within PRS allow for reports, and each can have as many reports as is required.&lt;br /&gt;
&lt;br /&gt;
== Creating a Report ==&lt;br /&gt;
&lt;br /&gt;
To create a report, you will need the &amp;quot;Design Reports&amp;quot; [[Security Token]].&lt;br /&gt;
Then, simply navigate to any screen on PRS, and click the little arrow in the ribbon bar at the top, as displayed in the picture. This will open up a new grid, from which you can create new report templates. Each report template in this grid acts as a &amp;quot;template&amp;quot; for the report; it tells PRS how to display the data. To create a new report, simply click the &amp;quot;+&amp;quot; button down the bottom, and fill in the required fields.&lt;br /&gt;
&lt;br /&gt;
=== Fields ===&lt;br /&gt;
&lt;br /&gt;
==== Name ====&lt;br /&gt;
The name is the name of the report, displayed in the main ribbon of PRS. It should be descriptive about what data the report displays.&lt;br /&gt;
&lt;br /&gt;
==== Visible ====&lt;br /&gt;
Determines whether the report should be visible in PRS. If this is not checked, there will be no way to generate the report. This should be used when you have old reports that are no longer necessary, but you don&#039;t want to delete them in case you need them again, or, if you are currently working on a report&#039;s design and don&#039;t want it to be visible yet.&lt;br /&gt;
&lt;br /&gt;
==== All Records / Selected Records ====&lt;br /&gt;
These fields determine what data should be used in the report. Most panels in PRS have a way to select data, and these fields determine whether all data in PRS should be used, or just the records that have been selected. If neither are selected, the report will not be able to be generated. If both are selected, there will be an option to choose which one when generating the report later on.&lt;br /&gt;
&lt;br /&gt;
=== Loading &amp;amp; Saving ===&lt;br /&gt;
On the left hand side of the report grid, there are two buttons for loading and saving reports from/to files. This allows you to take a report template and reload it somewhere else. Note that this is prone to errors, since a report is intrinsically tied to the type of data that is being loaded; hence, if you export a report for [[Kanban|Tasks]] and then import it for [[Job|Projects]], there will most likely be errors, since the data that represents a Job is different from that of a Task. Hence, this is not recommended unless you know what you are doing.&lt;br /&gt;
&lt;br /&gt;
== Report Design ==&lt;br /&gt;
&lt;br /&gt;
Reports can be designed from two places in PRS - first, from the Report Manager, where you create new reports (See [[#Creating a Report|Creating a Report]]). On the right hand-side of this grid, there is a pencil icon, which, if clicked, brings up the report designer.&lt;br /&gt;
&lt;br /&gt;
The other place that reports can be designed from is the preview window, brought up by clicking on the report in the ribbon (See [[Generating Reports]]). From the preview window, click the pencil icon in the top right, and this opens the designer. If designed this way, there is also data pre-loaded into the report, since you have previewed the report. This means that you can design the report and then preview with data already loaded, assisting you to design based on how the end product will look with data.&lt;br /&gt;
&lt;br /&gt;
PRS uses the [https://www.fast-report.com/en/ FastReport] engine and designer for its reporting system, and so details on how to use the report designer can be found on their [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/Fundamentals.html online documentation]. That being said, there are several important points that can be mentioned here as well.&lt;br /&gt;
&lt;br /&gt;
=== Previewing ===&lt;br /&gt;
&lt;br /&gt;
The report can be previewed from the designer. Click on &amp;quot;File -&amp;gt; Preview...&amp;quot; This will preview the current report as you&#039;ve designed it. Note that this does not save the report, so don&#039;t forget to return to the designer and hit the save button to ensure your changes are committed. Also, if you loaded the report from the PRS ribbon, instead of the report manager (see [[#Printing Reports|Printing Reports]]), then this preview will use the data that was loaded when printing the report.&lt;br /&gt;
&lt;br /&gt;
=== Selecting Data ===&lt;br /&gt;
&lt;br /&gt;
The data to be loaded into the report comes in the form of tables; each table corresponds to a specific &amp;quot;type&amp;quot; of data. An &amp;quot;Employee&amp;quot; table will contain data for [[Employee|Employees]], and an &amp;quot;Equipment&amp;quot; table contains data about [[Equipment]]. A few of the table names are slightly different than what they might appear in PRS, e.g. the table for [[Task|Tasks]] is named &amp;quot;Kanban&amp;quot;. So when you want to generate a report on your tasks, the data you will need will be in the &amp;quot;Kanban&amp;quot; table.&lt;br /&gt;
&lt;br /&gt;
Each table has a number of columns which map to the individual properties of an object, so &amp;quot;Kanban&amp;quot; has columns for its &amp;quot;Number&amp;quot;, its &amp;quot;Title&amp;quot;, and many others. Each row of the table is a specific object.&lt;br /&gt;
&lt;br /&gt;
It is important to tell PRS what data you need - there exists a vast number of tables that PRS knows how to load, but you will not want PRS to load all this data, since that can take a while. To choose the data you want to report on, navigate to &amp;quot;Data -&amp;gt; Choose Report Data...&amp;quot;. This will bring up a menu from which you can select a number of tables to load data for. Several of these are loaded by default, such as the &amp;quot;CompanyInformation&amp;quot; table, &amp;quot;CompanyLogo&amp;quot; table and the table related to the specific data - generating a report for tasks will automatically load the &amp;quot;Kanban&amp;quot; table. Other tables that &#039;&#039;can&#039;&#039; be loaded (but are not by default) are those that are related to the main object. So, since tasks can have associated equipment items, there is also a &amp;quot;Kanban_Equipment&amp;quot; table. The &amp;quot;Kanban_&amp;quot; prefix represents the fact that this is, in a way, a &amp;quot;child table&amp;quot; of &amp;quot;Kanban&amp;quot; - there is a link between the tables. The report designer knows about these relationships between the tables, so the associated relationships can be modelled using the report designer&#039;s concepts of Detail Bands (see the [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/DataBand/MasterDetailRelations.html documentation]). In order to tell PRS to also load the equipment associated with the tasks, check the little box next to &amp;quot;Kanban_Equipment&amp;quot;, so that it displays a tick. Then, next time you preview the report, PRS will also load the data required.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;quot;Kanban_Equipment&amp;quot; table does not load every piece of equipment in PRS - it only loads the equipment items that are related to the tasks that you selected - if only one task was selected to generate the report, then the &amp;quot;Kanban_Equipment&amp;quot; table will have at most &#039;&#039;one&#039;&#039; equipment item, since only one piece of equipment is able to be attached to a task.&lt;br /&gt;
&lt;br /&gt;
You can also select particular columns from the data selection window, but at this stage this does not cause less data to be loaded - it just prevents it being displayed in the various windows in the report designer and thus removes from view unnecessary fields that clutter up the screen.&lt;br /&gt;
&lt;br /&gt;
== Printing Reports ==&lt;br /&gt;
&lt;br /&gt;
Once you have created and designed a report, it is now ready to be generated/printed. In PRS, navigate to the panel where you created the report, and, if the report was set to [[#Visible|Visible]], it will now appear in the bar at the top. This will be visible to anyone with the &amp;quot;Print Reports&amp;quot; [[Security Token]], and by clicking on the report, the relevant data will be assembled, and the report generated from the data.&lt;br /&gt;
&lt;br /&gt;
Generating the report will open the report preview window, from which you view, print, or save to PDF. Additionally, if you have the &amp;quot;Design Reports&amp;quot; [[Security Token]], then there will also be a pencil icon, which you can click to edit the report in the designer, allowing for a quick backwards and forwards between the design and preview modes. Additionally, since generating the report allows means there is now data to print from, it is often easier to design a report by first printing it to give it some data to work with, and then designing from the preview window, allowing you to see the changes that you make by clicking &amp;quot;Preview&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=143</id>
		<title>Report Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=143"/>
		<updated>2022-12-16T01:37:57Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Report Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Report Template system gives the ability to generate reports based on the data with PRS, assisting in displaying and reporting on whatever is required. All main panels within PRS allow for reports, and each can have as many reports as is required.&lt;br /&gt;
&lt;br /&gt;
== Creating a Report ==&lt;br /&gt;
&lt;br /&gt;
To create a report, you will need the &amp;quot;Design Reports&amp;quot; [[Security Token]].&lt;br /&gt;
Then, simply navigate to any screen on PRS, and click the little arrow in the ribbon bar at the top, as displayed in the picture. This will open up a new grid, from which you can create new report templates. Each report template in this grid acts as a &amp;quot;template&amp;quot; for the report; it tells PRS how to display the data. To create a new report, simply click the &amp;quot;+&amp;quot; button down the bottom, and fill in the required fields.&lt;br /&gt;
&lt;br /&gt;
=== Fields ===&lt;br /&gt;
&lt;br /&gt;
==== Name ====&lt;br /&gt;
The name is the name of the report, displayed in the main ribbon of PRS. It should be descriptive about what data the report displays.&lt;br /&gt;
&lt;br /&gt;
==== Visible ====&lt;br /&gt;
Determines whether the report should be visible in PRS. If this is not checked, there will be no way to generate the report. This should be used when you have old reports that are no longer necessary, but you don&#039;t want to delete them in case you need them again, or, if you are currently working on a report&#039;s design and don&#039;t want it to be visible yet.&lt;br /&gt;
&lt;br /&gt;
==== All Records / Selected Records ====&lt;br /&gt;
These fields determine what data should be used in the report. Most panels in PRS have a way to select data, and these fields determine whether all data in PRS should be used, or just the records that have been selected. If neither are selected, the report will not be able to be generated. If both are selected, there will be an option to choose which one when generating the report later on.&lt;br /&gt;
&lt;br /&gt;
=== Loading &amp;amp; Saving ===&lt;br /&gt;
On the left hand side of the report grid, there are two buttons for loading and saving reports from/to files. This allows you to take a report template and reload it somewhere else. Note that this is prone to errors, since a report is intrinsically tied to the type of data that is being loaded; hence, if you export a report for [[Kanban|Tasks]] and then import it for [[Job|Projects]], there will most likely be errors, since the data that represents a Job is different from that of a Task. Hence, this is not recommended unless you know what you are doing.&lt;br /&gt;
&lt;br /&gt;
== Report Design ==&lt;br /&gt;
&lt;br /&gt;
Reports can be designed from two places in PRS - first, from the Report Manager, where you create new reports (See [[Creating Reports]]). On the right hand-side of this grid, there is a pencil icon, which, if clicked, brings up the report designer.&lt;br /&gt;
&lt;br /&gt;
The other place that reports can be designed from is the preview window, brought up by clicking on the report in the ribbon (See [[Generating Reports]]). From the preview window, click the pencil icon in the top right, and this opens the designer. If designed this way, there is also data pre-loaded into the report, since you have previewed the report. This means that you can design the report and then preview with data already loaded, assisting you to design based on how the end product will look with data.&lt;br /&gt;
&lt;br /&gt;
PRS uses the [https://www.fast-report.com/en/ FastReport] engine and designer for its reporting system, and so details on how to use the report designer can be found on their [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/Fundamentals.html online documentation]. That being said, there are several important points that can be mentioned here as well.&lt;br /&gt;
&lt;br /&gt;
=== Previewing ===&lt;br /&gt;
&lt;br /&gt;
The report can be previewed from the designer. Click on &amp;quot;File -&amp;gt; Preview...&amp;quot; This will preview the current report as you&#039;ve designed it. Note that this does not save the report, so don&#039;t forget to return to the designer and hit the save button to ensure your changes are committed. Also, if you loaded the report from the PRS ribbon, instead of the report manager (see [[#Printing Reports|Printing Reports]]), then this preview will use the data that was loaded when printing the report.&lt;br /&gt;
&lt;br /&gt;
=== Selecting Data ===&lt;br /&gt;
&lt;br /&gt;
The data to be loaded into the report comes in the form of tables; each table corresponds to a specific &amp;quot;type&amp;quot; of data. An &amp;quot;Employee&amp;quot; table will contain data for [[Employee|Employees]], and an &amp;quot;Equipment&amp;quot; table contains data about [[Equipment]]. A few of the table names are slightly different than what they might appear in PRS, e.g. the table for [[Task|Tasks]] is named &amp;quot;Kanban&amp;quot;. So when you want to generate a report on your tasks, the data you will need will be in the &amp;quot;Kanban&amp;quot; table.&lt;br /&gt;
&lt;br /&gt;
Each table has a number of columns which map to the individual properties of an object, so &amp;quot;Kanban&amp;quot; has columns for its &amp;quot;Number&amp;quot;, its &amp;quot;Title&amp;quot;, and many others. Each row of the table is a specific object.&lt;br /&gt;
&lt;br /&gt;
It is important to tell PRS what data you need - there exists a vast number of tables that PRS knows how to load, but you will not want PRS to load all this data, since that can take a while. To choose the data you want to report on, navigate to &amp;quot;Data -&amp;gt; Choose Report Data...&amp;quot;. This will bring up a menu from which you can select a number of tables to load data for. Several of these are loaded by default, such as the &amp;quot;CompanyInformation&amp;quot; table, &amp;quot;CompanyLogo&amp;quot; table and the table related to the specific data - generating a report for tasks will automatically load the &amp;quot;Kanban&amp;quot; table. Other tables that &#039;&#039;can&#039;&#039; be loaded (but are not by default) are those that are related to the main object. So, since tasks can have associated equipment items, there is also a &amp;quot;Kanban_Equipment&amp;quot; table. The &amp;quot;Kanban_&amp;quot; prefix represents the fact that this is, in a way, a &amp;quot;child table&amp;quot; of &amp;quot;Kanban&amp;quot; - there is a link between the tables. The report designer knows about these relationships between the tables, so the associated relationships can be modelled using the report designer&#039;s concepts of Detail Bands (see the [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/DataBand/MasterDetailRelations.html documentation]). In order to tell PRS to also load the equipment associated with the tasks, check the little box next to &amp;quot;Kanban_Equipment&amp;quot;, so that it displays a tick. Then, next time you preview the report, PRS will also load the data required.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;quot;Kanban_Equipment&amp;quot; table does not load every piece of equipment in PRS - it only loads the equipment items that are related to the tasks that you selected - if only one task was selected to generate the report, then the &amp;quot;Kanban_Equipment&amp;quot; table will have at most &#039;&#039;one&#039;&#039; equipment item, since only one piece of equipment is able to be attached to a task.&lt;br /&gt;
&lt;br /&gt;
You can also select particular columns from the data selection window, but at this stage this does not cause less data to be loaded - it just prevents it being displayed in the various windows in the report designer and thus removes from view unnecessary fields that clutter up the screen.&lt;br /&gt;
&lt;br /&gt;
== Printing Reports ==&lt;br /&gt;
&lt;br /&gt;
Once you have created and designed a report, it is now ready to be generated/printed. In PRS, navigate to the panel where you created the report, and, if the report was set to [[#Visible|Visible]], it will now appear in the bar at the top. This will be visible to anyone with the &amp;quot;Print Reports&amp;quot; [[Security Token]], and by clicking on the report, the relevant data will be assembled, and the report generated from the data.&lt;br /&gt;
&lt;br /&gt;
Generating the report will open the report preview window, from which you view, print, or save to PDF. Additionally, if you have the &amp;quot;Design Reports&amp;quot; [[Security Token]], then there will also be a pencil icon, which you can click to edit the report in the designer, allowing for a quick backwards and forwards between the design and preview modes. Additionally, since generating the report allows means there is now data to print from, it is often easier to design a report by first printing it to give it some data to work with, and then designing from the preview window, allowing you to see the changes that you make by clicking &amp;quot;Preview&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=142</id>
		<title>Report Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=142"/>
		<updated>2022-12-16T01:33:24Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Report Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Report Template system gives the ability to generate reports based on the data with PRS, assisting in displaying and reporting on whatever is required. All main panels within PRS allow for reports, and each can have as many reports as is required.&lt;br /&gt;
&lt;br /&gt;
== Creating a Report ==&lt;br /&gt;
&lt;br /&gt;
To create a report, you will need the &amp;quot;Design Reports&amp;quot; [[Security Token]].&lt;br /&gt;
Then, simply navigate to any screen on PRS, and click the little arrow in the ribbon bar at the top, as displayed in the picture. This will open up a new grid, from which you can create new report templates. Each report template in this grid acts as a &amp;quot;template&amp;quot; for the report; it tells PRS how to display the data. To create a new report, simply click the &amp;quot;+&amp;quot; button down the bottom, and fill in the required fields.&lt;br /&gt;
&lt;br /&gt;
=== Fields ===&lt;br /&gt;
&lt;br /&gt;
==== Name ====&lt;br /&gt;
The name is the name of the report, displayed in the main ribbon of PRS. It should be descriptive about what data the report displays.&lt;br /&gt;
&lt;br /&gt;
==== Visible ====&lt;br /&gt;
Determines whether the report should be visible in PRS. If this is not checked, there will be no way to generate the report. This should be used when you have old reports that are no longer necessary, but you don&#039;t want to delete them in case you need them again, or, if you are currently working on a report&#039;s design and don&#039;t want it to be visible yet.&lt;br /&gt;
&lt;br /&gt;
==== All Records / Selected Records ====&lt;br /&gt;
These fields determine what data should be used in the report. Most panels in PRS have a way to select data, and these fields determine whether all data in PRS should be used, or just the records that have been selected. If neither are selected, the report will not be able to be generated. If both are selected, there will be an option to choose which one when generating the report later on.&lt;br /&gt;
&lt;br /&gt;
=== Loading &amp;amp; Saving ===&lt;br /&gt;
On the left hand side of the report grid, there are two buttons for loading and saving reports from/to files. This allows you to take a report template and reload it somewhere else. Note that this is prone to errors, since a report is intrinsically tied to the type of data that is being loaded; hence, if you export a report for [[Kanban|Tasks]] and then import it for [[Job|Projects]], there will most likely be errors, since the data that represents a Job is different from that of a Task. Hence, this is not recommended unless you know what you are doing.&lt;br /&gt;
&lt;br /&gt;
== Report Design ==&lt;br /&gt;
&lt;br /&gt;
Reports can be designed from two places in PRS - first, from the Report Manager, where you create new reports (See [[Creating Reports]]). On the right hand-side of this grid, there is a pencil icon, which, if clicked, brings up the report designer.&lt;br /&gt;
&lt;br /&gt;
The other place that reports can be designed from is the preview window, brought up by clicking on the report in the ribbon (See [[Generating Reports]]). From the preview window, click the pencil icon in the top right, and this opens the designer. If designed this way, there is also data pre-loaded into the report, since you have previewed the report. This means that you can design the report and then preview with data already loaded, assisting you to design based on how the end product will look with data.&lt;br /&gt;
&lt;br /&gt;
PRS uses the [https://www.fast-report.com/en/ FastReport] engine and designer for its reporting system, and so details on how to use the report designer can be found on their [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/Fundamentals.html online documentation]. That being said, there are several important points that can be mentioned here as well.&lt;br /&gt;
&lt;br /&gt;
=== Selecting Data ===&lt;br /&gt;
&lt;br /&gt;
The data to be loaded into the report comes in the form of tables; each table corresponds to a specific &amp;quot;type&amp;quot; of data. An &amp;quot;Employee&amp;quot; table will contain data for [[Employee|Employees]], and an &amp;quot;Equipment&amp;quot; table contains data about [[Equipment]]. A few of the table names are slightly different than what they might appear in PRS, e.g. the table for [[Task|Tasks]] is named &amp;quot;Kanban&amp;quot;. So when you want to generate a report on your tasks, the data you will need will be in the &amp;quot;Kanban&amp;quot; table.&lt;br /&gt;
&lt;br /&gt;
Each table has a number of columns which map to the individual properties of an object, so &amp;quot;Kanban&amp;quot; has columns for its &amp;quot;Number&amp;quot;, its &amp;quot;Title&amp;quot;, and many others. Each row of the table is a specific object.&lt;br /&gt;
&lt;br /&gt;
It is important to tell PRS what data you need - there exists a vast number of tables that PRS knows how to load, but you will not want PRS to load all this data, since that can take a while. To choose the data you want to report on, navigate to &amp;quot;Data -&amp;gt; Choose Report Data...&amp;quot;. This will bring up a menu from which you can select a number of tables to load data for. Several of these are loaded by default, such as the &amp;quot;CompanyInformation&amp;quot; table, &amp;quot;CompanyLogo&amp;quot; table and the table related to the specific data - generating a report for tasks will automatically load the &amp;quot;Kanban&amp;quot; table. Other tables that &#039;&#039;can&#039;&#039; be loaded (but are not by default) are those that are related to the main object. So, since tasks can have associated equipment items, there is also a &amp;quot;Kanban_Equipment&amp;quot; table. The &amp;quot;Kanban_&amp;quot; prefix represents the fact that this is, in a way, a &amp;quot;child table&amp;quot; of &amp;quot;Kanban&amp;quot; - there is a link between the tables. The report designer knows about these relationships between the tables, so the associated relationships can be modelled using the report designer&#039;s concepts of Detail Bands (see the [https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/DataBand/MasterDetailRelations.html documentation]). In order to tell PRS to also load the equipment associated with the tasks, check the little box next to &amp;quot;Kanban_Equipment&amp;quot;, so that it displays a tick. Then, next time you preview the report, PRS will also load the data required.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;quot;Kanban_Equipment&amp;quot; table does not load every piece of equipment in PRS - it only loads the equipment items that are related to the tasks that you selected - if only one task was selected to generate the report, then the &amp;quot;Kanban_Equipment&amp;quot; table will have at most &#039;&#039;one&#039;&#039; equipment item, since only one piece of equipment is able to be attached to a task.&lt;br /&gt;
&lt;br /&gt;
You can also select particular columns from the data selection window, but at this stage this does not cause less data to be loaded - it just prevents it being displayed in the various windows in the report designer and thus removes from view unnecessary fields that clutter up the screen.&lt;br /&gt;
&lt;br /&gt;
== Printing Reports ==&lt;br /&gt;
&lt;br /&gt;
Once you have created and designed a report, it is now ready to be generated/printed. In PRS, navigate to the panel where you created the report, and, if the report was set to [[#Visible|Visible]], it will now appear in the bar at the top. This will be visible to anyone with the &amp;quot;Print Reports&amp;quot; [[Security Token]], and by clicking on the report, the relevant data will be assembled, and the report generated from the data.&lt;br /&gt;
&lt;br /&gt;
Generating the report will open the report preview window, from which you view, print, or save to PDF. Additionally, if you have the &amp;quot;Design Reports&amp;quot; [[Security Token]], then there will also be a pencil icon, which you can click to edit the report in the designer, allowing for a quick backwards and forwards between the design and preview modes. Additionally, since generating the report allows means there is now data to print from, it is often easier to design a report by first printing it to give it some data to work with, and then designing from the preview window, allowing you to see the changes that you make by clicking &amp;quot;Preview&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=141</id>
		<title>Report Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=141"/>
		<updated>2022-12-16T01:06:50Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Generating Reports */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Report Template system gives the ability to generate reports based on the data with PRS, assisting in displaying and reporting on whatever is required. All main panels within PRS allow for reports, and each can have as many reports as is required.&lt;br /&gt;
&lt;br /&gt;
== Creating a Report ==&lt;br /&gt;
&lt;br /&gt;
To create a report, you will need the &amp;quot;Design Reports&amp;quot; [[Security Token]].&lt;br /&gt;
Then, simply navigate to any screen on PRS, and click the little arrow in the ribbon bar at the top, as displayed in the picture. This will open up a new grid, from which you can create new report templates. Each report template in this grid acts as a &amp;quot;template&amp;quot; for the report; it tells PRS how to display the data. To create a new report, simply click the &amp;quot;+&amp;quot; button down the bottom, and fill in the required fields.&lt;br /&gt;
&lt;br /&gt;
=== Fields ===&lt;br /&gt;
&lt;br /&gt;
==== Name ====&lt;br /&gt;
The name is the name of the report, displayed in the main ribbon of PRS. It should be descriptive about what data the report displays.&lt;br /&gt;
&lt;br /&gt;
==== Visible ====&lt;br /&gt;
Determines whether the report should be visible in PRS. If this is not checked, there will be no way to generate the report. This should be used when you have old reports that are no longer necessary, but you don&#039;t want to delete them in case you need them again, or, if you are currently working on a report&#039;s design and don&#039;t want it to be visible yet.&lt;br /&gt;
&lt;br /&gt;
==== All Records / Selected Records ====&lt;br /&gt;
These fields determine what data should be used in the report. Most panels in PRS have a way to select data, and these fields determine whether all data in PRS should be used, or just the records that have been selected. If neither are selected, the report will not be able to be generated. If both are selected, there will be an option to choose which one when generating the report later on.&lt;br /&gt;
&lt;br /&gt;
=== Loading &amp;amp; Saving ===&lt;br /&gt;
On the left hand side of the report grid, there are two buttons for loading and saving reports from/to files. This allows you to take a report template and reload it somewhere else. Note that this is prone to errors, since a report is intrinsically tied to the type of data that is being loaded; hence, if you export a report for [[Kanban|Tasks]] and then import it for [[Job|Projects]], there will most likely be errors, since the data that represents a Job is different from that of a Task. Hence, this is not recommended unless you know what you are doing.&lt;br /&gt;
&lt;br /&gt;
== Report Design ==&lt;br /&gt;
TBC&lt;br /&gt;
&lt;br /&gt;
== Printing Reports ==&lt;br /&gt;
&lt;br /&gt;
Once you have created and designed a report, it is now ready to be generated/printed. In PRS, navigate to the panel where you created the report, and, if the report was set to [[#Visible|Visible]], it will now appear in the bar at the top. This will be visible to anyone with the &amp;quot;Print Reports&amp;quot; [[Security Token]], and by clicking on the report, the relevant data will be assembled, and the report generated from the data.&lt;br /&gt;
&lt;br /&gt;
Generating the report will open the report preview window, from which you view, print, or save to PDF. Additionally, if you have the &amp;quot;Design Reports&amp;quot; [[Security Token]], then there will also be a pencil icon, which you can click to edit the report in the designer, allowing for a quick backwards and forwards between the design and preview modes. Additionally, since generating the report allows means there is now data to print from, it is often easier to design a report by first printing it to give it some data to work with, and then designing from the preview window, allowing you to see the changes that you make by clicking &amp;quot;Preview&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=140</id>
		<title>Report Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=140"/>
		<updated>2022-12-16T00:57:40Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Loading &amp;amp; Saving */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Report Template system gives the ability to generate reports based on the data with PRS, assisting in displaying and reporting on whatever is required. All main panels within PRS allow for reports, and each can have as many reports as is required.&lt;br /&gt;
&lt;br /&gt;
== Creating a Report ==&lt;br /&gt;
&lt;br /&gt;
To create a report, you will need the &amp;quot;Design Reports&amp;quot; [[Security Token]].&lt;br /&gt;
Then, simply navigate to any screen on PRS, and click the little arrow in the ribbon bar at the top, as displayed in the picture. This will open up a new grid, from which you can create new report templates. Each report template in this grid acts as a &amp;quot;template&amp;quot; for the report; it tells PRS how to display the data. To create a new report, simply click the &amp;quot;+&amp;quot; button down the bottom, and fill in the required fields.&lt;br /&gt;
&lt;br /&gt;
=== Fields ===&lt;br /&gt;
&lt;br /&gt;
==== Name ====&lt;br /&gt;
The name is the name of the report, displayed in the main ribbon of PRS. It should be descriptive about what data the report displays.&lt;br /&gt;
&lt;br /&gt;
==== Visible ====&lt;br /&gt;
Determines whether the report should be visible in PRS. If this is not checked, there will be no way to generate the report. This should be used when you have old reports that are no longer necessary, but you don&#039;t want to delete them in case you need them again, or, if you are currently working on a report&#039;s design and don&#039;t want it to be visible yet.&lt;br /&gt;
&lt;br /&gt;
==== All Records / Selected Records ====&lt;br /&gt;
These fields determine what data should be used in the report. Most panels in PRS have a way to select data, and these fields determine whether all data in PRS should be used, or just the records that have been selected. If neither are selected, the report will not be able to be generated. If both are selected, there will be an option to choose which one when generating the report later on.&lt;br /&gt;
&lt;br /&gt;
=== Loading &amp;amp; Saving ===&lt;br /&gt;
On the left hand side of the report grid, there are two buttons for loading and saving reports from/to files. This allows you to take a report template and reload it somewhere else. Note that this is prone to errors, since a report is intrinsically tied to the type of data that is being loaded; hence, if you export a report for [[Kanban|Tasks]] and then import it for [[Job|Projects]], there will most likely be errors, since the data that represents a Job is different from that of a Task. Hence, this is not recommended unless you know what you are doing.&lt;br /&gt;
&lt;br /&gt;
== Report Design ==&lt;br /&gt;
TBC&lt;br /&gt;
&lt;br /&gt;
== Generating Reports ==&lt;br /&gt;
TBC&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=139</id>
		<title>Report Template</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Report_Template&amp;diff=139"/>
		<updated>2022-12-15T09:29:50Z</updated>

		<summary type="html">&lt;p&gt;Kenric: Created page with &amp;quot;The Report Template system gives the ability to generate reports based on the data with PRS, assisting in displaying and reporting on whatever is required. All main panels within PRS allow for reports, and each can have as many reports as is required.  == Creating a Report ==  To create a report, you will need the &amp;quot;Design Reports&amp;quot; Security Token. Then, simply navigate to any screen on PRS, and click the little arrow in the ribbon bar at the top, as displayed in the p...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Report Template system gives the ability to generate reports based on the data with PRS, assisting in displaying and reporting on whatever is required. All main panels within PRS allow for reports, and each can have as many reports as is required.&lt;br /&gt;
&lt;br /&gt;
== Creating a Report ==&lt;br /&gt;
&lt;br /&gt;
To create a report, you will need the &amp;quot;Design Reports&amp;quot; [[Security Token]].&lt;br /&gt;
Then, simply navigate to any screen on PRS, and click the little arrow in the ribbon bar at the top, as displayed in the picture. This will open up a new grid, from which you can create new report templates. Each report template in this grid acts as a &amp;quot;template&amp;quot; for the report; it tells PRS how to display the data. To create a new report, simply click the &amp;quot;+&amp;quot; button down the bottom, and fill in the required fields.&lt;br /&gt;
&lt;br /&gt;
=== Fields ===&lt;br /&gt;
&lt;br /&gt;
==== Name ====&lt;br /&gt;
The name is the name of the report, displayed in the main ribbon of PRS. It should be descriptive about what data the report displays.&lt;br /&gt;
&lt;br /&gt;
==== Visible ====&lt;br /&gt;
Determines whether the report should be visible in PRS. If this is not checked, there will be no way to generate the report. This should be used when you have old reports that are no longer necessary, but you don&#039;t want to delete them in case you need them again, or, if you are currently working on a report&#039;s design and don&#039;t want it to be visible yet.&lt;br /&gt;
&lt;br /&gt;
==== All Records / Selected Records ====&lt;br /&gt;
These fields determine what data should be used in the report. Most panels in PRS have a way to select data, and these fields determine whether all data in PRS should be used, or just the records that have been selected. If neither are selected, the report will not be able to be generated. If both are selected, there will be an option to choose which one when generating the report later on.&lt;br /&gt;
&lt;br /&gt;
=== Loading &amp;amp; Saving ===&lt;br /&gt;
On the left hand side of the report grid, there are two buttons for loading and saving reports from/to files. This allows you to take a report template and reload it somewhere else. Note that this is prone to errors, since a report is intrinsically tied to the type of data that is being loaded; hence, if you export a report for [[Kanban|Tasks]] and then import it for [[Job|Projects]], there will most likely be related errors. Hence, this is not recommended unless you know what you are doing.&lt;br /&gt;
&lt;br /&gt;
== Report Design ==&lt;br /&gt;
TBC&lt;br /&gt;
&lt;br /&gt;
== Generating Reports ==&lt;br /&gt;
TBC&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=DF_Layout_Header&amp;diff=138</id>
		<title>DF Layout Header</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=DF_Layout_Header&amp;diff=138"/>
		<updated>2022-12-12T05:09:22Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Fields */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Header layout item allows for collapsing of grouped form items under a header. Once created, it is expandable and collapsible, and, when collapsed, all items up to the next header or to the end of the form are collapsed under the header item. Inside the digital form, the user may tap on the header to expand or collapse it.&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
[[File:Header Properties.png|thumb|558x558px|Header Properties]]&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Header&amp;quot; field determines what the displayed text in the header will be - this should be a short description of what form fields are grouped under this header, so that when the group is collapsed, it is clear what fields have been collapsed under the header.&lt;br /&gt;
&lt;br /&gt;
=== Collapsed ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Collapsed&amp;quot; field determines whether the header is collapsed by default - if ticked, the header will be collapsed when opening the form and must be tapped to open. If not ticked, the header will be expanded when opening the form, but the user may collapse if they want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
[[File:Preview header.png|thumb|607x607px|Preview mode]]&lt;br /&gt;
The following example demonstrates an example form with two headers, and how they appear on the Desktop.&lt;br /&gt;
[[File:HeaderDesign.png|left|thumb|631x631px|Design mode]]&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=File:Preview_header.png&amp;diff=137</id>
		<title>File:Preview header.png</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=File:Preview_header.png&amp;diff=137"/>
		<updated>2022-12-12T05:08:20Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Two headers, one of which is collapsed by default&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=File:HeaderDesign.png&amp;diff=136</id>
		<title>File:HeaderDesign.png</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=File:HeaderDesign.png&amp;diff=136"/>
		<updated>2022-12-12T05:07:39Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A form design mode displaying two headers, one of which is default collapsed.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=File:Header_Properties.png&amp;diff=135</id>
		<title>File:Header Properties.png</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=File:Header_Properties.png&amp;diff=135"/>
		<updated>2022-12-12T05:01:13Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The properties for a header item.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=DF_Layout_Header&amp;diff=134</id>
		<title>DF Layout Header</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=DF_Layout_Header&amp;diff=134"/>
		<updated>2022-12-12T04:59:56Z</updated>

		<summary type="html">&lt;p&gt;Kenric: Created page with &amp;quot;The Header layout item allows for collapsing of grouped form items under a header. Once created, it is expandable and collapsible, and, when collapsed, all items up to the next header or to the end of the form are collapsed under the header item. Inside the digital form, the user may tap on the header to expand or collapse it.  == Fields ==  === Header ===  The &amp;quot;Header&amp;quot; field determines what the displayed text in the header will be - this should be a short description of...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Header layout item allows for collapsing of grouped form items under a header. Once created, it is expandable and collapsible, and, when collapsed, all items up to the next header or to the end of the form are collapsed under the header item. Inside the digital form, the user may tap on the header to expand or collapse it.&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Header&amp;quot; field determines what the displayed text in the header will be - this should be a short description of what form fields are grouped under this header, so that when the group is collapsed, it is clear what fields have been collapsed under the header.&lt;br /&gt;
&lt;br /&gt;
=== Collapsed ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Collapsed&amp;quot; field determines whether the header is collapsed by default - if ticked, the header will be collapsed when opening the form and must be tapped to open. If not ticked, the header will be expanded when opening the form, but the user may collapse if they want.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=PRS/WebStyle&amp;diff=81</id>
		<title>PRS/WebStyle</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=PRS/WebStyle&amp;diff=81"/>
		<updated>2022-08-18T07:41:36Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WebStyles are closely associated with WebTemplates, providing a means by which one can apply stylesheets to their pages. Using this system allows for a consistent styling across pages (or a subset of pages), since they would all speak to a certain WebStyle. Note also that despite being intended for CSS styling, they can contain any data, meaning the system could be used for other types of documents.&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
=== Code ===&lt;br /&gt;
The Code field is the unique identifier by which a given WebStyle is accessed. This should be somewhat descriptive, since it must be referenced via other pages, but it is recommended to keep it short and sweet.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
An arbitrary field by which one can give a description for the WebStyle. It is non-functional, but provides a reference on top of the code for humans to identify the purpose or contents of the WebStyle.&lt;br /&gt;
&lt;br /&gt;
== How To Use ==&lt;br /&gt;
Once you have created a [[PRS/WebTemplate|WebTemplate]], you can pull in stylesheets through the WebDatabaseInterface class. Simply call &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(code)&amp;lt;/code&amp;gt;, which returns an object of type &amp;lt;code&amp;gt;WebStyle&amp;lt;/code&amp;gt;. This class has an attribute named &amp;lt;code&amp;gt;Style&amp;lt;/code&amp;gt;, which contains the raw text from the WebStyle. Thus, to load and apply a style, put this markup in the &amp;lt;code&amp;gt;&amp;lt;head&amp;gt;&amp;lt;/code&amp;gt; tag of your template:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;style&amp;gt; @(WebDatabaseInterface.GetStylesheet(&amp;quot;EXAMPLE&amp;quot;).Style) &amp;lt;/style&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Loading Multiple Stylesheets ===&lt;br /&gt;
Since each call to &amp;lt;code&amp;gt;GetStylesheet&amp;lt;/code&amp;gt; results in a request to the database, it can be beneficial to load multiple stylesheets at once. This is made possible with the &amp;lt;code&amp;gt;GetStylesheets&amp;lt;/code&amp;gt; function, as demonstrated:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dictionary&amp;lt;string, WebStyle&amp;gt; styles = WebDatabaseInterface.GetStylesheets(&amp;quot;FIRST&amp;quot;, &amp;quot;SECOND&amp;quot;);&lt;br /&gt;
&amp;lt;style&amp;gt;&lt;br /&gt;
@(styles[&amp;quot;FIRST&amp;quot;].Style)&lt;br /&gt;
@(styles[&amp;quot;SECOND&amp;quot;].Style)&lt;br /&gt;
&amp;lt;/style&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=PRS/WebStyle&amp;diff=80</id>
		<title>PRS/WebStyle</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=PRS/WebStyle&amp;diff=80"/>
		<updated>2022-08-18T07:34:19Z</updated>

		<summary type="html">&lt;p&gt;Kenric: Created page with &amp;quot;WebStyles are closely associated with WebTemplates, providing a means by which one can apply stylesheets to their pages. Using this system allows for a consistent styling across pages (or a subset of pages), since they would all speak to a certain WebStyle. Note also that despite being intended for CSS styling, they can contain any data, meaning the system could be used for other types of documents.  == Fields == === Code === The Code field is the unique identifier by wh...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WebStyles are closely associated with WebTemplates, providing a means by which one can apply stylesheets to their pages. Using this system allows for a consistent styling across pages (or a subset of pages), since they would all speak to a certain WebStyle. Note also that despite being intended for CSS styling, they can contain any data, meaning the system could be used for other types of documents.&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
=== Code ===&lt;br /&gt;
The Code field is the unique identifier by which a given WebStyle is accessed. This should be somewhat descriptive, since it must be referenced via other pages, but it is recommended to keep it short and sweet.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
An arbitrary field by which one can give a description for the WebStyle. It is non-functional, but provides a reference on top of the code for humans to identify the purpose or contents of the WebStyle.&lt;br /&gt;
&lt;br /&gt;
== How To Use ==&lt;br /&gt;
Once you have created a [[PRS/WebTemplate|WebTemplate]], you can pull in stylesheets through the WebDatabaseInterface class. Simply call &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(code)&amp;lt;/code&amp;gt;, which returns an object of type &amp;lt;code&amp;gt;WebStyle&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=79</id>
		<title>PRS/WebTemplate</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=79"/>
		<updated>2022-08-18T07:33:38Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Styling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Web Templates are the manner in which the Web Engine interfaces with a user, written in HTML with C# support using the Razor templating engine. Upon receiving a request from a user, the WebEngine finds the template that is required and then executes it, recompiling if changes have been made.&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
=== DataModel ===&lt;br /&gt;
The DataModel field is a name of an entity type, such as Equipment or Employee, which specifies the specific data to load for the page template. For example, if you are writing a page which lists employees, it is useful to preload the data necessary - this is done by setting DataModel to &amp;quot;Employee&amp;quot;. This field is optional.&lt;br /&gt;
&lt;br /&gt;
=== Slug ===&lt;br /&gt;
The Slug field denotes the name of the page itself, intended to be a short text field which describes the function of the page. Note that it cannot contain any slashes (&#039;/&#039;, &#039;\&#039;), and should use only characters which are URL-safe; when in doubt, stick to just numbers and letters.&lt;br /&gt;
&lt;br /&gt;
The DataModel and slug fields combine to form a path to the page, with the form &#039;&#039;www.domain.com/v1/DataModel/Slug?id=XXXXXXXX-XXXX-XXXX-XXXXXXXX&#039;&#039;. If the DataModel field is empty, then the URL is simply &#039;&#039;www.domain.com/v1/Slug&#039;&#039;. This allows you to create pages which do not have to be tied to a specific entity. If a page has a DataModel and the id query does not match any page, then a 404 Not Found is returned to the user.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
The Description field is a non-functional field which allows you to add a description to the template - this is not necessary, but can be useful as a reference.&lt;br /&gt;
&lt;br /&gt;
=== Visible ===&lt;br /&gt;
The Visible field denotes whether the page is accessibly via a URL - if it is not visible, then a 404 Not Found is returned when trying to access it - it is as if it didn&#039;t exist. Use this if you want to disable a page or if the template is only relevant in the context of other templates - see [[#Partial Templates|Partial Templates]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Writing a Template ==&lt;br /&gt;
To write a template, you should be familiar with HTML, CSS and JavaScript as well as C#, which is used for non-static content.&lt;br /&gt;
&lt;br /&gt;
=== Basics ===&lt;br /&gt;
At its base, a template is an HTML file - that is, that one can write a static web page, without the use of C#, and it would display as it would in a browser. Note that this has no means of accessing any resources outside of the page, so any styling with CSS must be embedded.&lt;br /&gt;
&lt;br /&gt;
The page is then able to contain embedded C# code, using the Razor syntax. Roughly, one can embed a C# expression by preceding it with an &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt;, e.g. &amp;lt;code&amp;gt;@employee.Name&amp;lt;/code&amp;gt;. If the expression is too complex, surround it with parentheses, &amp;lt;code&amp;gt;@(GenericMethod&amp;lt;string&amp;gt;())&amp;lt;/code&amp;gt;. To execute blocks of code, use &amp;lt;code&amp;gt;@{ ... }&amp;lt;/code&amp;gt;, and for control structures like &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;foreach&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; should come before the keyword, e.g. &amp;lt;code&amp;gt;@if(condition){ ... }&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Within a block of code, one can return to HTML simply by using HTML tags, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@if(condition){&lt;br /&gt;
    &amp;lt;p&amp;gt;Condition is true&amp;lt;/p&amp;gt;&lt;br /&gt;
} else {&lt;br /&gt;
    string error = &amp;quot;Condition is false&amp;quot;;&lt;br /&gt;
    &amp;lt;p&amp;gt;@error&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
To add a stylesheet, you can create a [[PRS/WebStyle|WebStyle]], which can be loaded with &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(string code)&amp;lt;/code&amp;gt;, which retrieves the content of that stylesheet as raw text. Thus, to use a WebStyle with the code &amp;quot;MAIN&amp;quot;, one would put in the &amp;lt;code&amp;gt;&amp;amp;lt;head&amp;amp;gt;&amp;lt;/code&amp;gt; tag:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
@(WebDatabaseInterface.GetStylesheet(&amp;quot;MAIN&amp;quot;).Style)&lt;br /&gt;
&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This would load that stylesheet into the current web page.&amp;lt;br&amp;gt;If multiple stylesheets need to be loaded, consider using &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheets(params string[] stylesheetCodes)&amp;lt;/code&amp;gt;, which gets all the stylesheets in request.&lt;br /&gt;
&lt;br /&gt;
=== Using DataModels ===&lt;br /&gt;
The Razor engine provides to each template page a parameter called &amp;lt;code&amp;gt;Model&amp;lt;/code&amp;gt;, by which data can be retrieved. By default, it contains no data except for a table called &amp;quot;User&amp;quot;, which contains the current user. To load the required data for the page, a call to &amp;lt;code&amp;gt;Model.LoadModel(string[] requiredTables, params IDataModelQueryDef[] requiredQueries)&amp;lt;/code&amp;gt; must be executed.&lt;br /&gt;
&lt;br /&gt;
The first parameter, &amp;lt;code&amp;gt;requiredTables&amp;lt;/code&amp;gt;, specifies which tables should be loaded. By default, &amp;lt;code&amp;gt;LoadModel&amp;lt;/code&amp;gt; loads nothing. In general, the CompanyInformation, CompanyLogo and the current entity are useful to load, so a call could look like:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Model.LoadModel(new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;})&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second parameter specifies a way to narrow the load of the data, preventing unnecessary data from being loaded. For example, if one only requires the ID and Name fields of an employee, one might call:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(&lt;br /&gt;
    new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;},&lt;br /&gt;
    new DataModelQueryDef&amp;lt;Employee&amp;gt;(&lt;br /&gt;
        null,&lt;br /&gt;
        new Columns&amp;lt;Employee&amp;gt;(x =&amp;gt; x.ID).Add(x =&amp;gt; x.Name),&lt;br /&gt;
        null)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By default, all columns in the database are loaded, so this is a way to drastically reduce the amount of data loaded.&lt;br /&gt;
(The other two fields, set to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, specify a filter and sort order for the retrieved data.)&lt;br /&gt;
&lt;br /&gt;
==== Retrieving Data ====&lt;br /&gt;
To get a table that has been loaded, use &amp;lt;code&amp;gt;Model.GetTable&amp;lt;T&amp;gt;(alias)&amp;lt;/code&amp;gt;. This returns an object of type &amp;lt;code&amp;gt;CoreTable&amp;lt;/code&amp;gt;, which has a property &amp;lt;code&amp;gt;Rows&amp;lt;/code&amp;gt;, through which one can retrieve data. An example is shown here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(new string[] {&amp;quot;Employee&amp;quot;}); // Load Model&lt;br /&gt;
CoreTable employeeTable = Model.GetTable&amp;lt;Employee&amp;gt;(); // Get Table from Model&lt;br /&gt;
&lt;br /&gt;
// Iterate through the rows&lt;br /&gt;
foreach(CoreRow row in employeeTable.Rows){&lt;br /&gt;
    // Convert the row to an Employee. This is not necessary, and the data can also be retrieved with row[ColumnName] or row.ToDictionary()[ColumnName]&lt;br /&gt;
    var employee = row.ToObject&amp;lt;Employee&amp;gt;();&lt;br /&gt;
    &amp;lt;p&amp;gt;@employee.ID: @employee.Name&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Partial Templates ===&lt;br /&gt;
Sometimes it is useful to write a &#039;&#039;partial template&#039;&#039;, that is, one that only represents part of a web page and is used elsewhere, e.g. a header which is used site-wide. This is possible. First, create a web template with the Visible property unchecked. Leave the DataModel blank, since that is only useful when loading the page from an HTTP request. For this example, give it the Slug &#039;&#039;header&#039;&#039;, and set its content to be:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;header&amp;gt;&lt;br /&gt;
    &amp;lt;h1&amp;gt;The Title&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, within the main page, call &amp;lt;code&amp;gt;@Raw(WebHandler.RunTemplate(WebDatabaseInterface.GetWebTemplateBySlug(&amp;quot;header&amp;quot;), Model))&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Through this, the header will be inserted into the main page. Note that @Raw is required, for otherwise the retrieved HTML will be displayed as plain text, rather than interpreted as HTML.&lt;br /&gt;
&lt;br /&gt;
This method can also be used for loading stylesheets which must load styling information non-statically. Simply save the stylesheet as a WebTemplate instead of as a WebStyle, and the load it as a template.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=78</id>
		<title>PRS/WebTemplate</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=78"/>
		<updated>2022-08-18T06:53:27Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Slug */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Web Templates are the manner in which the Web Engine interfaces with a user, written in HTML with C# support using the Razor templating engine. Upon receiving a request from a user, the WebEngine finds the template that is required and then executes it, recompiling if changes have been made.&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
=== DataModel ===&lt;br /&gt;
The DataModel field is a name of an entity type, such as Equipment or Employee, which specifies the specific data to load for the page template. For example, if you are writing a page which lists employees, it is useful to preload the data necessary - this is done by setting DataModel to &amp;quot;Employee&amp;quot;. This field is optional.&lt;br /&gt;
&lt;br /&gt;
=== Slug ===&lt;br /&gt;
The Slug field denotes the name of the page itself, intended to be a short text field which describes the function of the page. Note that it cannot contain any slashes (&#039;/&#039;, &#039;\&#039;), and should use only characters which are URL-safe; when in doubt, stick to just numbers and letters.&lt;br /&gt;
&lt;br /&gt;
The DataModel and slug fields combine to form a path to the page, with the form &#039;&#039;www.domain.com/v1/DataModel/Slug?id=XXXXXXXX-XXXX-XXXX-XXXXXXXX&#039;&#039;. If the DataModel field is empty, then the URL is simply &#039;&#039;www.domain.com/v1/Slug&#039;&#039;. This allows you to create pages which do not have to be tied to a specific entity. If a page has a DataModel and the id query does not match any page, then a 404 Not Found is returned to the user.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
The Description field is a non-functional field which allows you to add a description to the template - this is not necessary, but can be useful as a reference.&lt;br /&gt;
&lt;br /&gt;
=== Visible ===&lt;br /&gt;
The Visible field denotes whether the page is accessibly via a URL - if it is not visible, then a 404 Not Found is returned when trying to access it - it is as if it didn&#039;t exist. Use this if you want to disable a page or if the template is only relevant in the context of other templates - see [[#Partial Templates|Partial Templates]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Writing a Template ==&lt;br /&gt;
To write a template, you should be familiar with HTML, CSS and JavaScript as well as C#, which is used for non-static content.&lt;br /&gt;
&lt;br /&gt;
=== Basics ===&lt;br /&gt;
At its base, a template is an HTML file - that is, that one can write a static web page, without the use of C#, and it would display as it would in a browser. Note that this has no means of accessing any resources outside of the page, so any styling with CSS must be embedded.&lt;br /&gt;
&lt;br /&gt;
The page is then able to contain embedded C# code, using the Razor syntax. Roughly, one can embed a C# expression by preceding it with an &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt;, e.g. &amp;lt;code&amp;gt;@employee.Name&amp;lt;/code&amp;gt;. If the expression is too complex, surround it with parentheses, &amp;lt;code&amp;gt;@(GenericMethod&amp;lt;string&amp;gt;())&amp;lt;/code&amp;gt;. To execute blocks of code, use &amp;lt;code&amp;gt;@{ ... }&amp;lt;/code&amp;gt;, and for control structures like &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;foreach&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; should come before the keyword, e.g. &amp;lt;code&amp;gt;@if(condition){ ... }&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Within a block of code, one can return to HTML simply by using HTML tags, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@if(condition){&lt;br /&gt;
    &amp;lt;p&amp;gt;Condition is true&amp;lt;/p&amp;gt;&lt;br /&gt;
} else {&lt;br /&gt;
    string error = &amp;quot;Condition is false&amp;quot;;&lt;br /&gt;
    &amp;lt;p&amp;gt;@error&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
To add a stylesheet, you can create a [[PRS/WebStyle|WebStyle]], which can be loaded with &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(string code)&amp;lt;/code&amp;gt;, which retrieves the content of that stylesheet as raw text. Thus, to use a WebStyle with the code &amp;quot;MAIN&amp;quot;, one would put in the &amp;lt;code&amp;gt;&amp;amp;lt;head&amp;amp;gt;&amp;lt;/code&amp;gt; tag:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
@(WebDatabaseInterface.GetStylesheet(&amp;quot;MAIN&amp;quot;))&lt;br /&gt;
&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This would load that stylesheet into the current web page.&amp;lt;br&amp;gt;If multiple stylesheets need to be loaded, consider using &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheets(params string[] stylesheetCodes)&amp;lt;/code&amp;gt;, which gets all the stylesheets in request.&lt;br /&gt;
&lt;br /&gt;
=== Using DataModels ===&lt;br /&gt;
The Razor engine provides to each template page a parameter called &amp;lt;code&amp;gt;Model&amp;lt;/code&amp;gt;, by which data can be retrieved. By default, it contains no data except for a table called &amp;quot;User&amp;quot;, which contains the current user. To load the required data for the page, a call to &amp;lt;code&amp;gt;Model.LoadModel(string[] requiredTables, params IDataModelQueryDef[] requiredQueries)&amp;lt;/code&amp;gt; must be executed.&lt;br /&gt;
&lt;br /&gt;
The first parameter, &amp;lt;code&amp;gt;requiredTables&amp;lt;/code&amp;gt;, specifies which tables should be loaded. By default, &amp;lt;code&amp;gt;LoadModel&amp;lt;/code&amp;gt; loads nothing. In general, the CompanyInformation, CompanyLogo and the current entity are useful to load, so a call could look like:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Model.LoadModel(new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;})&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second parameter specifies a way to narrow the load of the data, preventing unnecessary data from being loaded. For example, if one only requires the ID and Name fields of an employee, one might call:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(&lt;br /&gt;
    new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;},&lt;br /&gt;
    new DataModelQueryDef&amp;lt;Employee&amp;gt;(&lt;br /&gt;
        null,&lt;br /&gt;
        new Columns&amp;lt;Employee&amp;gt;(x =&amp;gt; x.ID).Add(x =&amp;gt; x.Name),&lt;br /&gt;
        null)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By default, all columns in the database are loaded, so this is a way to drastically reduce the amount of data loaded.&lt;br /&gt;
(The other two fields, set to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, specify a filter and sort order for the retrieved data.)&lt;br /&gt;
&lt;br /&gt;
==== Retrieving Data ====&lt;br /&gt;
To get a table that has been loaded, use &amp;lt;code&amp;gt;Model.GetTable&amp;lt;T&amp;gt;(alias)&amp;lt;/code&amp;gt;. This returns an object of type &amp;lt;code&amp;gt;CoreTable&amp;lt;/code&amp;gt;, which has a property &amp;lt;code&amp;gt;Rows&amp;lt;/code&amp;gt;, through which one can retrieve data. An example is shown here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(new string[] {&amp;quot;Employee&amp;quot;}); // Load Model&lt;br /&gt;
CoreTable employeeTable = Model.GetTable&amp;lt;Employee&amp;gt;(); // Get Table from Model&lt;br /&gt;
&lt;br /&gt;
// Iterate through the rows&lt;br /&gt;
foreach(CoreRow row in employeeTable.Rows){&lt;br /&gt;
    // Convert the row to an Employee. This is not necessary, and the data can also be retrieved with row[ColumnName] or row.ToDictionary()[ColumnName]&lt;br /&gt;
    var employee = row.ToObject&amp;lt;Employee&amp;gt;();&lt;br /&gt;
    &amp;lt;p&amp;gt;@employee.ID: @employee.Name&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Partial Templates ===&lt;br /&gt;
Sometimes it is useful to write a &#039;&#039;partial template&#039;&#039;, that is, one that only represents part of a web page and is used elsewhere, e.g. a header which is used site-wide. This is possible. First, create a web template with the Visible property unchecked. Leave the DataModel blank, since that is only useful when loading the page from an HTTP request. For this example, give it the Slug &#039;&#039;header&#039;&#039;, and set its content to be:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;header&amp;gt;&lt;br /&gt;
    &amp;lt;h1&amp;gt;The Title&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, within the main page, call &amp;lt;code&amp;gt;@Raw(WebHandler.RunTemplate(WebDatabaseInterface.GetWebTemplateBySlug(&amp;quot;header&amp;quot;), Model))&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Through this, the header will be inserted into the main page. Note that @Raw is required, for otherwise the retrieved HTML will be displayed as plain text, rather than interpreted as HTML.&lt;br /&gt;
&lt;br /&gt;
This method can also be used for loading stylesheets which must load styling information non-statically. Simply save the stylesheet as a WebTemplate instead of as a WebStyle, and the load it as a template.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=77</id>
		<title>PRS/WebTemplate</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=77"/>
		<updated>2022-08-18T06:53:15Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Web Templates are the manner in which the Web Engine interfaces with a user, written in HTML with C# support using the Razor templating engine. Upon receiving a request from a user, the WebEngine finds the template that is required and then executes it, recompiling if changes have been made.&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
=== Slug ===&lt;br /&gt;
The DataModel field is a name of an entity type, such as Equipment or Employee, which specifies the specific data to load for the page template. For example, if you are writing a page which lists employees, it is useful to preload the data necessary - this is done by setting DataModel to &amp;quot;Employee&amp;quot;. This field is optional.&lt;br /&gt;
&lt;br /&gt;
=== Slug ===&lt;br /&gt;
The Slug field denotes the name of the page itself, intended to be a short text field which describes the function of the page. Note that it cannot contain any slashes (&#039;/&#039;, &#039;\&#039;), and should use only characters which are URL-safe; when in doubt, stick to just numbers and letters.&lt;br /&gt;
&lt;br /&gt;
The DataModel and slug fields combine to form a path to the page, with the form &#039;&#039;www.domain.com/v1/DataModel/Slug?id=XXXXXXXX-XXXX-XXXX-XXXXXXXX&#039;&#039;. If the DataModel field is empty, then the URL is simply &#039;&#039;www.domain.com/v1/Slug&#039;&#039;. This allows you to create pages which do not have to be tied to a specific entity. If a page has a DataModel and the id query does not match any page, then a 404 Not Found is returned to the user.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
The Description field is a non-functional field which allows you to add a description to the template - this is not necessary, but can be useful as a reference.&lt;br /&gt;
&lt;br /&gt;
=== Visible ===&lt;br /&gt;
The Visible field denotes whether the page is accessibly via a URL - if it is not visible, then a 404 Not Found is returned when trying to access it - it is as if it didn&#039;t exist. Use this if you want to disable a page or if the template is only relevant in the context of other templates - see [[#Partial Templates|Partial Templates]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Writing a Template ==&lt;br /&gt;
To write a template, you should be familiar with HTML, CSS and JavaScript as well as C#, which is used for non-static content.&lt;br /&gt;
&lt;br /&gt;
=== Basics ===&lt;br /&gt;
At its base, a template is an HTML file - that is, that one can write a static web page, without the use of C#, and it would display as it would in a browser. Note that this has no means of accessing any resources outside of the page, so any styling with CSS must be embedded.&lt;br /&gt;
&lt;br /&gt;
The page is then able to contain embedded C# code, using the Razor syntax. Roughly, one can embed a C# expression by preceding it with an &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt;, e.g. &amp;lt;code&amp;gt;@employee.Name&amp;lt;/code&amp;gt;. If the expression is too complex, surround it with parentheses, &amp;lt;code&amp;gt;@(GenericMethod&amp;lt;string&amp;gt;())&amp;lt;/code&amp;gt;. To execute blocks of code, use &amp;lt;code&amp;gt;@{ ... }&amp;lt;/code&amp;gt;, and for control structures like &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;foreach&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; should come before the keyword, e.g. &amp;lt;code&amp;gt;@if(condition){ ... }&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Within a block of code, one can return to HTML simply by using HTML tags, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@if(condition){&lt;br /&gt;
    &amp;lt;p&amp;gt;Condition is true&amp;lt;/p&amp;gt;&lt;br /&gt;
} else {&lt;br /&gt;
    string error = &amp;quot;Condition is false&amp;quot;;&lt;br /&gt;
    &amp;lt;p&amp;gt;@error&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
To add a stylesheet, you can create a [[PRS/WebStyle|WebStyle]], which can be loaded with &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(string code)&amp;lt;/code&amp;gt;, which retrieves the content of that stylesheet as raw text. Thus, to use a WebStyle with the code &amp;quot;MAIN&amp;quot;, one would put in the &amp;lt;code&amp;gt;&amp;amp;lt;head&amp;amp;gt;&amp;lt;/code&amp;gt; tag:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
@(WebDatabaseInterface.GetStylesheet(&amp;quot;MAIN&amp;quot;))&lt;br /&gt;
&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This would load that stylesheet into the current web page.&amp;lt;br&amp;gt;If multiple stylesheets need to be loaded, consider using &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheets(params string[] stylesheetCodes)&amp;lt;/code&amp;gt;, which gets all the stylesheets in request.&lt;br /&gt;
&lt;br /&gt;
=== Using DataModels ===&lt;br /&gt;
The Razor engine provides to each template page a parameter called &amp;lt;code&amp;gt;Model&amp;lt;/code&amp;gt;, by which data can be retrieved. By default, it contains no data except for a table called &amp;quot;User&amp;quot;, which contains the current user. To load the required data for the page, a call to &amp;lt;code&amp;gt;Model.LoadModel(string[] requiredTables, params IDataModelQueryDef[] requiredQueries)&amp;lt;/code&amp;gt; must be executed.&lt;br /&gt;
&lt;br /&gt;
The first parameter, &amp;lt;code&amp;gt;requiredTables&amp;lt;/code&amp;gt;, specifies which tables should be loaded. By default, &amp;lt;code&amp;gt;LoadModel&amp;lt;/code&amp;gt; loads nothing. In general, the CompanyInformation, CompanyLogo and the current entity are useful to load, so a call could look like:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Model.LoadModel(new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;})&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second parameter specifies a way to narrow the load of the data, preventing unnecessary data from being loaded. For example, if one only requires the ID and Name fields of an employee, one might call:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(&lt;br /&gt;
    new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;},&lt;br /&gt;
    new DataModelQueryDef&amp;lt;Employee&amp;gt;(&lt;br /&gt;
        null,&lt;br /&gt;
        new Columns&amp;lt;Employee&amp;gt;(x =&amp;gt; x.ID).Add(x =&amp;gt; x.Name),&lt;br /&gt;
        null)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By default, all columns in the database are loaded, so this is a way to drastically reduce the amount of data loaded.&lt;br /&gt;
(The other two fields, set to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, specify a filter and sort order for the retrieved data.)&lt;br /&gt;
&lt;br /&gt;
==== Retrieving Data ====&lt;br /&gt;
To get a table that has been loaded, use &amp;lt;code&amp;gt;Model.GetTable&amp;lt;T&amp;gt;(alias)&amp;lt;/code&amp;gt;. This returns an object of type &amp;lt;code&amp;gt;CoreTable&amp;lt;/code&amp;gt;, which has a property &amp;lt;code&amp;gt;Rows&amp;lt;/code&amp;gt;, through which one can retrieve data. An example is shown here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(new string[] {&amp;quot;Employee&amp;quot;}); // Load Model&lt;br /&gt;
CoreTable employeeTable = Model.GetTable&amp;lt;Employee&amp;gt;(); // Get Table from Model&lt;br /&gt;
&lt;br /&gt;
// Iterate through the rows&lt;br /&gt;
foreach(CoreRow row in employeeTable.Rows){&lt;br /&gt;
    // Convert the row to an Employee. This is not necessary, and the data can also be retrieved with row[ColumnName] or row.ToDictionary()[ColumnName]&lt;br /&gt;
    var employee = row.ToObject&amp;lt;Employee&amp;gt;();&lt;br /&gt;
    &amp;lt;p&amp;gt;@employee.ID: @employee.Name&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Partial Templates ===&lt;br /&gt;
Sometimes it is useful to write a &#039;&#039;partial template&#039;&#039;, that is, one that only represents part of a web page and is used elsewhere, e.g. a header which is used site-wide. This is possible. First, create a web template with the Visible property unchecked. Leave the DataModel blank, since that is only useful when loading the page from an HTTP request. For this example, give it the Slug &#039;&#039;header&#039;&#039;, and set its content to be:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;header&amp;gt;&lt;br /&gt;
    &amp;lt;h1&amp;gt;The Title&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, within the main page, call &amp;lt;code&amp;gt;@Raw(WebHandler.RunTemplate(WebDatabaseInterface.GetWebTemplateBySlug(&amp;quot;header&amp;quot;), Model))&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Through this, the header will be inserted into the main page. Note that @Raw is required, for otherwise the retrieved HTML will be displayed as plain text, rather than interpreted as HTML.&lt;br /&gt;
&lt;br /&gt;
This method can also be used for loading stylesheets which must load styling information non-statically. Simply save the stylesheet as a WebTemplate instead of as a WebStyle, and the load it as a template.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=76</id>
		<title>PRS/WebTemplate</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=76"/>
		<updated>2022-08-18T06:53:03Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Web Templates are the manner in which the Web Engine interfaces with a user, written in HTML with C# support using the Razor templating engine. Upon receiving a request from a user, the WebEngine finds the template that is required and then executes it, recompiling if changes have been made.&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
=== Slug ===&lt;br /&gt;
The DataModel field is a name of an entity type, such as Equipment or Employee, which specifies the specific data to load for the page template. For example, if you are writing a page which lists employees, it is useful to preload the data necessary - this is done by setting DataModel to &amp;quot;Employee&amp;quot;. This field is optional.&lt;br /&gt;
&lt;br /&gt;
=== Slug ===&lt;br /&gt;
The Slug field denotes the name of the page itself, intended to be a short text field which describes the function of the page. Note that it cannot contain any slashes (&#039;/&#039;, &#039;\&#039;), and should use only characters which are URL-safe; when in doubt, stick to just numbers and letters.&lt;br /&gt;
&lt;br /&gt;
The DataModel and slug fields combine to form a path to the page, with the form &#039;&#039;www.domain.com/v1/DataModel/Slug?id=XXXXXXXX-XXXX-XXXX-XXXXXXXX&#039;&#039;. If the DataModel field is empty, then the URL is simply &#039;&#039;www.domain.com/v1/Slug&#039;&#039;. This allows you to create pages which do not have to be tied to a specific entity. If a page has a DataModel and the id query does not match any page, then a 404 Not Found is returned to the user.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
The Description field is a non-functional field which allows you to add a description to the template - this is not necessary, but can be useful as a reference.&lt;br /&gt;
&lt;br /&gt;
=== Visible ===&lt;br /&gt;
The Visible field denotes whether the page is accessibly via a URL - if it is not visible, then a 404 Not Found is returned when trying to access it - it is as if it didn&#039;t exist. Use this if you want to disable a page or if the template is only relevant in the context of other templates - see [[#Partial Templates|Partial Templates]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Writing a Template ==&lt;br /&gt;
To write a template, you should be familiar with HTML, CSS and JavaScript as well as C#, which is used for non-static content.&lt;br /&gt;
&lt;br /&gt;
=== Basics ===&lt;br /&gt;
At its base, a template is an HTML file - that is, that one can write a static web page, without the use of C#, and it would display as it would in a browser. Note that this has no means of accessing any resources outside of the page, so any styling with CSS must be embedded.&lt;br /&gt;
&lt;br /&gt;
The page is then able to contain embedded C# code, using the Razor syntax. Roughly, one can embed a C# expression by preceding it with an &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt;, e.g. &amp;lt;code&amp;gt;@employee.Name&amp;lt;/code&amp;gt;. If the expression is too complex, surround it with parentheses, &amp;lt;code&amp;gt;@(GenericMethod&amp;lt;string&amp;gt;())&amp;lt;/code&amp;gt;. To execute blocks of code, use &amp;lt;code&amp;gt;@{ ... }&amp;lt;/code&amp;gt;, and for control structures like &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;foreach&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; should come before the keyword, e.g. &amp;lt;code&amp;gt;@if(condition){ ... }&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Within a block of code, one can return to HTML simply by using HTML tags, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@if(condition){&lt;br /&gt;
    &amp;lt;p&amp;gt;Condition is true&amp;lt;/p&amp;gt;&lt;br /&gt;
} else {&lt;br /&gt;
    string error = &amp;quot;Condition is false&amp;quot;;&lt;br /&gt;
    &amp;lt;p&amp;gt;@error&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
To add a stylesheet, you can create a [[PRS/WebStyle|WebStyle]], which can be loaded with &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(string code)&amp;lt;/code&amp;gt;, which retrieves the content of that stylesheet as raw text. Thus, to use a WebStyle with the code &amp;quot;MAIN&amp;quot;, one would put in the &amp;lt;code&amp;gt;&amp;amp;lt;head&amp;amp;gt;&amp;lt;/code&amp;gt; tag:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
@(WebDatabaseInterface.GetStylesheet(&amp;quot;MAIN&amp;quot;))&lt;br /&gt;
&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This would load that stylesheet into the current web page.&amp;lt;br&amp;gt;If multiple stylesheets need to be loaded, consider using &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheets(params string[] stylesheetCodes)&amp;lt;/code&amp;gt;, which gets all the stylesheets in request.&lt;br /&gt;
&lt;br /&gt;
=== Using DataModels ===&lt;br /&gt;
The Razor engine provides to each template page a parameter called &amp;lt;code&amp;gt;Model&amp;lt;/code&amp;gt;, by which data can be retrieved. By default, it contains no data except for a table called &amp;quot;User&amp;quot;, which contains the current user. To load the required data for the page, a call to &amp;lt;code&amp;gt;Model.LoadModel(string[] requiredTables, params IDataModelQueryDef[] requiredQueries)&amp;lt;/code&amp;gt; must be executed.&lt;br /&gt;
&lt;br /&gt;
The first parameter, &amp;lt;code&amp;gt;requiredTables&amp;lt;/code&amp;gt;, specifies which tables should be loaded. By default, &amp;lt;code&amp;gt;LoadModel&amp;lt;/code&amp;gt; loads nothing. In general, the CompanyInformation, CompanyLogo and the current entity are useful to load, so a call could look like:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Model.LoadModel(new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;})&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second parameter specifies a way to narrow the load of the data, preventing unnecessary data from being loaded. For example, if one only requires the ID and Name fields of an employee, one might call:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(&lt;br /&gt;
    new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;},&lt;br /&gt;
    new DataModelQueryDef&amp;lt;Employee&amp;gt;(&lt;br /&gt;
        null,&lt;br /&gt;
        new Columns&amp;lt;Employee&amp;gt;(x =&amp;gt; x.ID).Add(x =&amp;gt; x.Name),&lt;br /&gt;
        null)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By default, all columns in the database are loaded, so this is a way to drastically reduce the amount of data loaded.&lt;br /&gt;
(The other two fields, set to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, specify a filter and sort order for the retrieved data.)&lt;br /&gt;
&lt;br /&gt;
==== Retrieving Data ====&lt;br /&gt;
To get a table that has been loaded, use &amp;lt;code&amp;gt;Model.GetTable&amp;lt;T&amp;gt;(alias)&amp;lt;/code&amp;gt;. This returns an object of type &amp;lt;code&amp;gt;CoreTable&amp;lt;/code&amp;gt;, which has a property &amp;lt;code&amp;gt;Rows&amp;lt;/code&amp;gt;, through which one can retrieve data. An example is shown here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(new string[] {&amp;quot;Employee&amp;quot;}); // Load Model&lt;br /&gt;
CoreTable employeeTable = Model.GetTable&amp;lt;Employee&amp;gt;(); // Get Table from Model&lt;br /&gt;
&lt;br /&gt;
// Iterate through the rows&lt;br /&gt;
foreach(CoreRow row in employeeTable.Rows){&lt;br /&gt;
    // Convert the row to an Employee. This is not necessary, and the data can also be retrieved with row[ColumnName] or row.ToDictionary()[ColumnName]&lt;br /&gt;
    var employee = row.ToObject&amp;lt;Employee&amp;gt;();&lt;br /&gt;
    &amp;lt;p&amp;gt;@employee.ID: @employee.Name&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Partial Templates ===&lt;br /&gt;
Sometimes it is useful to write a &#039;&#039;partial template&#039;&#039;, that is, one that only represents part of a web page and is used elsewhere, e.g. a header which is used site-wide. This is possible. First, create a web template with the Visible property unchecked. Leave the DataModel blank, since that is only useful when loading the page from an HTTP request. For this example, give it the Slug &#039;&#039;header&#039;&#039;, and set its content to be:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;header&amp;gt;&lt;br /&gt;
    &amp;lt;h1&amp;gt;The Title&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, within the main page, call &amp;lt;code&amp;gt;@Raw(WebHandler.RunTemplate(WebDatabaseInterface.GetWebTemplateBySlug(&amp;quot;header&amp;quot;), Model))&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Through this, the header will be inserted into the main page. Note that @Raw is required, for otherwise the retrieved HTML will be displayed as plain text, rather than interpreted as HTML.&lt;br /&gt;
&lt;br /&gt;
This method can also be used for loading stylesheets which must load styling information non-statically. Simply save the stylesheet as a WebTemplate instead of as a WebStyle, and the load it as a template.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=75</id>
		<title>PRS/WebTemplate</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=75"/>
		<updated>2022-08-18T06:45:08Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Web Templates are the manner in which the Web Engine interfaces with a user, written in HTML with C# support using the Razor templating engine. Upon receiving a request from a user&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
=== Slug ===&lt;br /&gt;
The DataModel field is a name of an entity type, such as Equipment or Employee, which specifies the specific data to load for the page template. For example, if you are writing a page which lists employees, it is useful to preload the data necessary - this is done by setting DataModel to &amp;quot;Employee&amp;quot;. This field is optional.&lt;br /&gt;
&lt;br /&gt;
=== Slug ===&lt;br /&gt;
The Slug field denotes the name of the page itself, intended to be a short text field which describes the function of the page. Note that it cannot contain any slashes (&#039;/&#039;, &#039;\&#039;), and should use only characters which are URL-safe; when in doubt, stick to just numbers and letters.&lt;br /&gt;
&lt;br /&gt;
The DataModel and slug fields combine to form a path to the page, with the form &#039;&#039;www.domain.com/v1/DataModel/Slug?id=XXXXXXXX-XXXX-XXXX-XXXXXXXX&#039;&#039;. If the DataModel field is empty, then the URL is simply &#039;&#039;www.domain.com/v1/Slug&#039;&#039;. This allows you to create pages which do not have to be tied to a specific entity. If a page has a DataModel and the id query does not match any page, then a 404 Not Found is returned to the user.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
The Description field is a non-functional field which allows you to add a description to the template - this is not necessary, but can be useful as a reference.&lt;br /&gt;
&lt;br /&gt;
=== Visible ===&lt;br /&gt;
The Visible field denotes whether the page is accessibly via a URL - if it is not visible, then a 404 Not Found is returned when trying to access it - it is as if it didn&#039;t exist. Use this if you want to disable a page or if the template is only relevant in the context of other templates - see [[#Partial Templates|Partial Templates]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Writing a Template ==&lt;br /&gt;
To write a template, you should be familiar with HTML, CSS and JavaScript as well as C#, which is used for non-static content.&lt;br /&gt;
&lt;br /&gt;
=== Basics ===&lt;br /&gt;
At its base, a template is an HTML file - that is, that one can write a static web page, without the use of C#, and it would display as it would in a browser. Note that this has no means of accessing any resources outside of the page, so any styling with CSS must be embedded.&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
To add a stylesheet, you can create a [[PRS/WebStyle|WebStyle]], which can be loaded with &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(string code)&amp;lt;/code&amp;gt;, which retrieves the content of that stylesheet as raw text. Thus, to use a WebStyle with the code &amp;quot;MAIN&amp;quot;, one would put in the &amp;lt;code&amp;gt;&amp;amp;lt;head&amp;amp;gt;&amp;lt;/code&amp;gt; tag:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
@(WebDatabaseInterface.GetStylesheet(&amp;quot;MAIN&amp;quot;))&lt;br /&gt;
&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This would load that stylesheet into the current web page.&amp;lt;br&amp;gt;If multiple stylesheets need to be loaded, consider using &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheets(params string[] stylesheetCodes)&amp;lt;/code&amp;gt;, which gets all the stylesheets in request.&lt;br /&gt;
&lt;br /&gt;
=== Using DataModels ===&lt;br /&gt;
The Razor engine provides to each template page a parameter called &amp;lt;code&amp;gt;Model&amp;lt;/code&amp;gt;, by which data can be retrieved. By default, it contains no data except for a table called &amp;quot;User&amp;quot;, which contains the current user. To load the required data for the page, a call to &amp;lt;code&amp;gt;Model.LoadModel(string[] requiredTables, params IDataModelQueryDef[] requiredQueries)&amp;lt;/code&amp;gt; must be executed.&lt;br /&gt;
&lt;br /&gt;
The first parameter, &amp;lt;code&amp;gt;requiredTables&amp;lt;/code&amp;gt;, specifies which tables should be loaded. By default, &amp;lt;code&amp;gt;LoadModel&amp;lt;/code&amp;gt; loads nothing. In general, the CompanyInformation, CompanyLogo and the current entity are useful to load, so a call could look like:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Model.LoadModel(new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;})&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second parameter specifies a way to narrow the load of the data, preventing unnecessary data from being loaded. For example, if one only requires the ID and Name fields of an employee, one might call:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(&lt;br /&gt;
    new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;},&lt;br /&gt;
    new DataModelQueryDef&amp;lt;Employee&amp;gt;(&lt;br /&gt;
        null,&lt;br /&gt;
        new Columns&amp;lt;Employee&amp;gt;(x =&amp;gt; x.ID).Add(x =&amp;gt; x.Name),&lt;br /&gt;
        null)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By default, all columns in the database are loaded, so this is a way to drastically reduce the amount of data loaded.&lt;br /&gt;
(The other two fields, set to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, specify a filter and sort order for the retrieved data.)&lt;br /&gt;
&lt;br /&gt;
==== Retrieving Data ====&lt;br /&gt;
To get a table that has been loaded, use &amp;lt;code&amp;gt;Model.GetTable&amp;lt;T&amp;gt;(alias)&amp;lt;/code&amp;gt;. This returns an object of type &amp;lt;code&amp;gt;CoreTable&amp;lt;/code&amp;gt;, which has a property &amp;lt;code&amp;gt;Rows&amp;lt;/code&amp;gt;, through which one can retrieve data. An example is shown here.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(new string[] {&amp;quot;Employee&amp;quot;}); // Load Model&lt;br /&gt;
CoreTable employeeTable = Model.GetTable&amp;lt;Employee&amp;gt;(); // Get Table from Model&lt;br /&gt;
&lt;br /&gt;
// Iterate through the rows&lt;br /&gt;
foreach(CoreRow row in employeeTable.Rows){&lt;br /&gt;
    // Convert the row to an Employee. This is not necessary, and the data can also be retrieved with row[ColumnName] or row.ToDictionary()[ColumnName]&lt;br /&gt;
    var employee = row.ToObject&amp;lt;Employee&amp;gt;();&lt;br /&gt;
    &amp;lt;p&amp;gt;@employee.ID: @employee.Name&amp;lt;/p&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Partial Templates ===&lt;br /&gt;
Sometimes it is useful to write a &#039;&#039;partial template&#039;&#039;, that is, one that only represents part of a web page and is used elsewhere, e.g. a header which is used site-wide. This is possible. First, create a web template with the Visible property unchecked. Leave the DataModel blank, since that is only useful when loading the page from an HTTP request. For this example, give it the Slug &#039;&#039;header&#039;&#039;, and set its content to be:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;header&amp;gt;&lt;br /&gt;
    &amp;lt;h1&amp;gt;The Title&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, within the main page, call &amp;lt;code&amp;gt;@Raw(WebHandler.RunTemplate(WebDatabaseInterface.GetWebTemplateBySlug(&amp;quot;header&amp;quot;), Model))&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Through this, the header will be inserted into the main page. Note that @Raw is required, for otherwise the retrieved HTML will be displayed as plain text, rather than interpreted as HTML.&lt;br /&gt;
&lt;br /&gt;
This method can also be used for loading stylesheets which must load styling information non-statically. Simply save the stylesheet as a WebTemplate instead of as a WebStyle, and the load it as a template.&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=74</id>
		<title>PRS/WebTemplate</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=74"/>
		<updated>2022-08-18T06:27:42Z</updated>

		<summary type="html">&lt;p&gt;Kenric: /* Using DataModels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Web Templates are the manner in which the Web Engine interfaces with a user, written in HTML with C# support using the Razor templating engine. Upon receiving a request from a user&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
=== Slug ===&lt;br /&gt;
The DataModel field is a name of an entity type, such as Equipment or Employee, which specifies the specific data to load for the page template. For example, if you are writing a page which lists employees, it is useful to preload the data necessary - this is done by setting DataModel to &amp;quot;Employee&amp;quot;. This field is optional.&lt;br /&gt;
&lt;br /&gt;
=== Slug ===&lt;br /&gt;
The Slug field denotes the name of the page itself, intended to be a short text field which describes the function of the page. Note that it cannot contain any slashes (&#039;/&#039;, &#039;\&#039;), and should use only characters which are URL-safe; when in doubt, stick to just numbers and letters.&lt;br /&gt;
&lt;br /&gt;
The DataModel and slug fields combine to form a path to the page, with the form &#039;&#039;www.domain.com/v1/DataModel/Slug?id=XXXXXXXX-XXXX-XXXX-XXXXXXXX&#039;&#039;. If the DataModel field is empty, then the URL is simply &#039;&#039;www.domain.com/v1/Slug&#039;&#039;. This allows you to create pages which do not have to be tied to a specific entity.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
The Description field is a non-functional field which allows you to add a description to the template - this is not necessary, but can be useful as a reference.&lt;br /&gt;
&lt;br /&gt;
=== Visible ===&lt;br /&gt;
The Visible field denotes whether the page is accessibly via a URL - if it is not visible, then a 404 Not Found is returned when trying to access it - it is as if it didn&#039;t exist. Use this if you want to disable a page or if the template is only relevant in the context of other templates - see [[#Partial Templates|Partial Templates]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Writing a Template ==&lt;br /&gt;
To write a template, you should be familiar with HTML, CSS and JavaScript as well as C#, which is used for non-static content.&lt;br /&gt;
&lt;br /&gt;
=== Basics ===&lt;br /&gt;
At its base, a template is an HTML file - that is, that one can write a static web page, without the use of C#, and it would display as it would in a browser. Note that this has no means of accessing any resources outside of the page, so any styling with CSS must be embedded.&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
To add a stylesheet, you can create a [[PRS/WebStyle|WebStyle]], which can be loaded with &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(string code)&amp;lt;/code&amp;gt;, which retrieves the content of that stylesheet as raw text. Thus, to use a WebStyle with the code &amp;quot;MAIN&amp;quot;, one would put in the &amp;lt;code&amp;gt;&amp;amp;lt;head&amp;amp;gt;&amp;lt;/code&amp;gt; tag:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
@(WebDatabaseInterface.GetStylesheet(&amp;quot;MAIN&amp;quot;))&lt;br /&gt;
&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This would load that stylesheet into the current web page.&amp;lt;br&amp;gt;If multiple stylesheets need to be loaded, consider using &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheets(params string[] stylesheetCodes)&amp;lt;/code&amp;gt;, which gets all the stylesheets in request.&lt;br /&gt;
&lt;br /&gt;
=== Using DataModels ===&lt;br /&gt;
The Razor engine provides to each template page a parameter called &amp;lt;code&amp;gt;Model&amp;lt;/code&amp;gt;, by which data can be retrieved. By default, it contains no data except for a table called &amp;quot;User&amp;quot;, which contains the current user. To load the required data for the page, a call to &amp;lt;code&amp;gt;Model.LoadModel(string[] requiredTables, params IDataModelQueryDef[] requiredQueries)&amp;lt;/code&amp;gt; must be executed.&lt;br /&gt;
&lt;br /&gt;
The first parameter, &amp;lt;code&amp;gt;requiredTables&amp;lt;/code&amp;gt;, specifies which tables should be loaded. By default, &amp;lt;code&amp;gt;LoadModel&amp;lt;/code&amp;gt; loads nothing. In general, the CompanyInformation, CompanyLogo and the current entity are useful to load, so a call could look like:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Model.LoadModel(new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;})&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second parameter specifies a way to narrow the load of the data, preventing unnecessary data from being loaded. For example, if one only requires the ID and Name fields of an employee, one might call:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model.LoadModel(&amp;lt;br&amp;gt;&lt;br /&gt;
    new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;},&lt;br /&gt;
    new DataModelQueryDef&amp;lt;Employee&amp;gt;(&lt;br /&gt;
        null,&lt;br /&gt;
        new Columns&amp;lt;Employee&amp;gt;(x =&amp;gt; x.ID).Add(x =&amp;gt; x.Name),&lt;br /&gt;
        null)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By default, all columns in the database are loaded, so this is a way to drastically reduce the amount of data loaded.&lt;br /&gt;
(The other two fields, set to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, specify a filter and sort order for the retrieved data.)&lt;br /&gt;
&lt;br /&gt;
=== Partial Templates ===&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=73</id>
		<title>PRS/WebTemplate</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=PRS/WebTemplate&amp;diff=73"/>
		<updated>2022-08-18T06:26:56Z</updated>

		<summary type="html">&lt;p&gt;Kenric: Created page with &amp;quot;== Introduction ==  Web Templates are the manner in which the Web Engine interfaces with a user, written in HTML with C# support using the Razor templating engine. Upon receiving a request from a user  == Fields == === Slug === The DataModel field is a name of an entity type, such as Equipment or Employee, which specifies the specific data to load for the page template. For example, if you are writing a page which lists employees, it is useful to preload the data necessa...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Web Templates are the manner in which the Web Engine interfaces with a user, written in HTML with C# support using the Razor templating engine. Upon receiving a request from a user&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
=== Slug ===&lt;br /&gt;
The DataModel field is a name of an entity type, such as Equipment or Employee, which specifies the specific data to load for the page template. For example, if you are writing a page which lists employees, it is useful to preload the data necessary - this is done by setting DataModel to &amp;quot;Employee&amp;quot;. This field is optional.&lt;br /&gt;
&lt;br /&gt;
=== Slug ===&lt;br /&gt;
The Slug field denotes the name of the page itself, intended to be a short text field which describes the function of the page. Note that it cannot contain any slashes (&#039;/&#039;, &#039;\&#039;), and should use only characters which are URL-safe; when in doubt, stick to just numbers and letters.&lt;br /&gt;
&lt;br /&gt;
The DataModel and slug fields combine to form a path to the page, with the form &#039;&#039;www.domain.com/v1/DataModel/Slug?id=XXXXXXXX-XXXX-XXXX-XXXXXXXX&#039;&#039;. If the DataModel field is empty, then the URL is simply &#039;&#039;www.domain.com/v1/Slug&#039;&#039;. This allows you to create pages which do not have to be tied to a specific entity.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
The Description field is a non-functional field which allows you to add a description to the template - this is not necessary, but can be useful as a reference.&lt;br /&gt;
&lt;br /&gt;
=== Visible ===&lt;br /&gt;
The Visible field denotes whether the page is accessibly via a URL - if it is not visible, then a 404 Not Found is returned when trying to access it - it is as if it didn&#039;t exist. Use this if you want to disable a page or if the template is only relevant in the context of other templates - see [[#Partial Templates|Partial Templates]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Writing a Template ==&lt;br /&gt;
To write a template, you should be familiar with HTML, CSS and JavaScript as well as C#, which is used for non-static content.&lt;br /&gt;
&lt;br /&gt;
=== Basics ===&lt;br /&gt;
At its base, a template is an HTML file - that is, that one can write a static web page, without the use of C#, and it would display as it would in a browser. Note that this has no means of accessing any resources outside of the page, so any styling with CSS must be embedded.&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
To add a stylesheet, you can create a [[PRS/WebStyle|WebStyle]], which can be loaded with &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheet(string code)&amp;lt;/code&amp;gt;, which retrieves the content of that stylesheet as raw text. Thus, to use a WebStyle with the code &amp;quot;MAIN&amp;quot;, one would put in the &amp;lt;code&amp;gt;&amp;amp;lt;head&amp;amp;gt;&amp;lt;/code&amp;gt; tag:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
@(WebDatabaseInterface.GetStylesheet(&amp;quot;MAIN&amp;quot;))&lt;br /&gt;
&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This would load that stylesheet into the current web page.&amp;lt;br&amp;gt;If multiple stylesheets need to be loaded, consider using &amp;lt;code&amp;gt;WebDatabaseInterface.GetStylesheets(params string[] stylesheetCodes)&amp;lt;/code&amp;gt;, which gets all the stylesheets in request.&lt;br /&gt;
&lt;br /&gt;
=== Using DataModels ===&lt;br /&gt;
The Razor engine provides to each template page a parameter called &amp;lt;code&amp;gt;Model&amp;lt;/code&amp;gt;, by which data can be retrieved. By default, it contains no data except for a table called &amp;quot;User&amp;quot;, which contains the current user. To load the required data for the page, a call to &amp;lt;code&amp;gt;Model.LoadModel(string[] requiredTables, params IDataModelQueryDef[] requiredQueries)&amp;lt;/code&amp;gt; must be executed.&lt;br /&gt;
&lt;br /&gt;
The first parameter, &amp;lt;code&amp;gt;requiredTables&amp;lt;/code&amp;gt;, specifies which tables should be loaded. By default, &amp;lt;code&amp;gt;LoadModel&amp;lt;/code&amp;gt; loads nothing. In general, the CompanyInformation, CompanyLogo and the current entity are useful to load, so a call could look like:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Model.LoadModel(new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;})&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second parameter specifies a way to narrow the load of the data, preventing unnecessary data from being loaded. For example, if one only requires the ID and Name fields of an employee, one might call:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
Model.LoadModel(&amp;lt;br&amp;gt;&lt;br /&gt;
    new string[] {&amp;quot;CompanyInformation&amp;quot;, &amp;quot;CompanyLogo&amp;quot;, &amp;quot;Employee&amp;quot;},&lt;br /&gt;
    new DataModelQueryDef&amp;lt;Employee&amp;gt;(&lt;br /&gt;
        null,&lt;br /&gt;
        new Columns&amp;lt;Employee&amp;gt;(x =&amp;gt; x.ID).Add(x =&amp;gt; x.Name),&lt;br /&gt;
        null)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By default, all columns in the database are loaded, so this is a way to drastically reduce the amount of data loaded.&lt;br /&gt;
(The other two fields, set to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, specify a filter and sort order for the retrieved data.)&lt;br /&gt;
&lt;br /&gt;
=== Partial Templates ===&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Database_Service&amp;diff=71</id>
		<title>Database Service</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Database_Service&amp;diff=71"/>
		<updated>2022-06-21T08:23:14Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:PRS Database Service Account Settings.png|none|thumb]]&lt;br /&gt;
The PRS database service is the engine room of PRS, providing access to one or more PRS databases.  In most cases, only one main database is required - however, there may be circumstances (for instance, multiple divisions or companies using the same infrastructure) where more than one database service may be running at the same time.&lt;br /&gt;
&lt;br /&gt;
To add a database service, click the &amp;quot;Add Service&amp;quot; button at the bottom right of the screen, and select &amp;quot;Database&amp;quot;:&lt;br /&gt;
[[File:PRS Add Database.png|none|thumb]]&lt;br /&gt;
The Database Properties screen will appear, allowing you to customise the service as required:&lt;br /&gt;
[[File:PRS Database Service General Settings.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
* The &amp;quot;Name&amp;quot; field provides a description of the database, which can be automatically provided to clients if the AutoDiscovery Service is enabled&lt;br /&gt;
&lt;br /&gt;
* The &amp;quot;File Name&amp;quot; filed indicates the location of the (not-yet-created) database itself - click the &amp;quot;Select&amp;quot; button at the right to choose a location and file name for the database.  If you have an existing database file, you can select this here to use the existing data - it will not be overwritten or erased.&lt;br /&gt;
* The &amp;quot;Port&amp;quot; field indicates the TCP port that the database service will listen on for client requests.  This port should be configured to allow traffic through any firewalls you may have installed.&lt;br /&gt;
&lt;br /&gt;
To ensure that the service can be validly installed on your system, click on the &amp;quot;Account&amp;quot; tab, and enter the Domain, User name and Password  for an account that has privileges to install services on your system:&lt;br /&gt;
[[File:PRS Database Server Account Details.png|none|thumb]]&lt;br /&gt;
(If you are using a local account, use &amp;quot;.&amp;quot; as the Domain Name)&lt;br /&gt;
&lt;br /&gt;
At this point you should see the Database Service appear in the list of available services:&lt;br /&gt;
[[File:PRS Database Service Status.png|none|thumb]]&lt;br /&gt;
The &amp;quot;Disk&amp;quot; image at the left indicates that this service is a Database.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Pause&amp;quot; image indicates that the service currently stopped - click this will start the service, after which the image will change to a &amp;quot;tick&amp;quot;:&lt;br /&gt;
[[File:PRS Database Service - Running.png|none|thumb]]&lt;br /&gt;
Once the service is running, a &amp;quot;target&amp;quot; indicator will appear in the right-hand column - clicking this will display a debug console to allow you to monitor service activity:&lt;br /&gt;
[[File:PRS Database Console.png|none|thumb]]&lt;br /&gt;
Since this log is reset when the debug console is closed, a full log can be found in a log file which is saved to the &amp;quot;Local System&amp;quot; service account&#039;s AppData folder. On 64-bit Windows, this can be found under &amp;quot;C:\Windows\SysWOW64\config\systemprofile\AppData\Roaming\PRSServer\PRSDatabase&amp;quot; folder as a &amp;quot;.log&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the service is successfully running, you can move on to adding and configuring additional services as required:&lt;br /&gt;
&lt;br /&gt;
* Add an [[AutoDiscovery Service|Auto Discovery Service]] to allow client workstations to automatically find and connect to this database&lt;br /&gt;
*Add a [[GPS Gateway Service]] to capture incoming GPS data from Digital Matter IoT devices&lt;br /&gt;
*Add a [[Scheduling Service|Scheduler Service]] to perform regular actions on you database&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Database_Service&amp;diff=70</id>
		<title>Database Service</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Database_Service&amp;diff=70"/>
		<updated>2022-06-21T08:22:42Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:PRS Database Service Account Settings.png|none|thumb]]&lt;br /&gt;
The PRS database service is the engine room of PRS, providing access to one or more PRS databases.  In most cases, only one main database is required - however, there may be circumstances (for instance, multiple divisions or companies using the same infrastructure) where more than one database service may be running at the same time.&lt;br /&gt;
&lt;br /&gt;
To add a database service, click the &amp;quot;Add Service&amp;quot; button at the bottom right of the screen, and select &amp;quot;Database&amp;quot;:&lt;br /&gt;
[[File:PRS Add Database.png|none|thumb]]&lt;br /&gt;
The Database Properties screen will appear, allowing you to customise the service as required:&lt;br /&gt;
[[File:PRS Database Service General Settings.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
* The &amp;quot;Name&amp;quot; field provides a description of the database, which can be automatically provided to clients if the AutoDiscovery Service is enabled&lt;br /&gt;
&lt;br /&gt;
* The &amp;quot;File Name&amp;quot; filed indicates the location of the (not-yet-created) database itself - click the &amp;quot;Select&amp;quot; button at the right to choose a location and file name for the database.  If you have an existing database file, you can select this here to use the existing data - it will not be overwritten or erased.&lt;br /&gt;
* The &amp;quot;Port&amp;quot; field indicates the TCP port that the database service will listen on for client requests.  This port should be configured to allow traffic through any firewalls you may have installed.&lt;br /&gt;
&lt;br /&gt;
To ensure that the service can be validly installed on your system, click on the &amp;quot;Account&amp;quot; tab, and enter the Domain, User name and Password  for an account that has privileges to install services on your system:&lt;br /&gt;
[[File:PRS Database Server Account Details.png|none|thumb]]&lt;br /&gt;
(If you are using a local account, use &amp;quot;.&amp;quot; as the Domain Name)&lt;br /&gt;
&lt;br /&gt;
At this point you should see the Database Service appear in the list of available services:&lt;br /&gt;
[[File:PRS Database Service Status.png|none|thumb]]&lt;br /&gt;
The &amp;quot;Disk&amp;quot; image at the left indicates that this service is a Database.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Pause&amp;quot; image indicates that the service currently stopped - click this will start the service, after which the image will change to a &amp;quot;tick&amp;quot;:&lt;br /&gt;
[[File:PRS Database Service - Running.png|none|thumb]]&lt;br /&gt;
Once the service is running, a &amp;quot;target&amp;quot; indicator will appear in the right-hand column - clicking this will display a debug console to allow you to monitor service activity:&lt;br /&gt;
[[File:PRS Database Console.png|none|thumb]]&lt;br /&gt;
Since this log is reset when the debug console is closed, a full log can be found in a log file which is saved to the &amp;quot;Local System&amp;quot; service account&#039;s AppData folder. On 64-bit Windows, this can be found under the &amp;quot;C:\Windows\SysWOW64\config\systemprofile\AppData\Roaming\PRSServer\PRSDatabase&amp;quot; folder as a &amp;quot;.log&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the service is successfully running, you can move on to adding and configuring additional services as required:&lt;br /&gt;
&lt;br /&gt;
* Add an [[AutoDiscovery Service|Auto Discovery Service]] to allow client workstations to automatically find and connect to this database&lt;br /&gt;
*Add a [[GPS Gateway Service]] to capture incoming GPS data from Digital Matter IoT devices&lt;br /&gt;
*Add a [[Scheduling Service|Scheduler Service]] to perform regular actions on you database&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Database_Service&amp;diff=69</id>
		<title>Database Service</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Database_Service&amp;diff=69"/>
		<updated>2022-06-21T08:22:17Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:PRS Database Service Account Settings.png|none|thumb]]&lt;br /&gt;
The PRS database service is the engine room of PRS, providing access to one or more PRS databases.  In most cases, only one main database is required - however, there may be circumstances (for instance, multiple divisions or companies using the same infrastructure) where more than one database service may be running at the same time.&lt;br /&gt;
&lt;br /&gt;
To add a database service, click the &amp;quot;Add Service&amp;quot; button at the bottom right of the screen, and select &amp;quot;Database&amp;quot;:&lt;br /&gt;
[[File:PRS Add Database.png|none|thumb]]&lt;br /&gt;
The Database Properties screen will appear, allowing you to customise the service as required:&lt;br /&gt;
[[File:PRS Database Service General Settings.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
* The &amp;quot;Name&amp;quot; field provides a description of the database, which can be automatically provided to clients if the AutoDiscovery Service is enabled&lt;br /&gt;
&lt;br /&gt;
* The &amp;quot;File Name&amp;quot; filed indicates the location of the (not-yet-created) database itself - click the &amp;quot;Select&amp;quot; button at the right to choose a location and file name for the database.  If you have an existing database file, you can select this here to use the existing data - it will not be overwritten or erased.&lt;br /&gt;
* The &amp;quot;Port&amp;quot; field indicates the TCP port that the database service will listen on for client requests.  This port should be configured to allow traffic through any firewalls you may have installed.&lt;br /&gt;
&lt;br /&gt;
To ensure that the service can be validly installed on your system, click on the &amp;quot;Account&amp;quot; tab, and enter the Domain, User name and Password  for an account that has privileges to install services on your system:&lt;br /&gt;
[[File:PRS Database Server Account Details.png|none|thumb]]&lt;br /&gt;
(If you are using a local account, use &amp;quot;.&amp;quot; as the Domain Name)&lt;br /&gt;
&lt;br /&gt;
At this point you should see the Database Service appear in the list of available services:&lt;br /&gt;
[[File:PRS Database Service Status.png|none|thumb]]&lt;br /&gt;
The &amp;quot;Disk&amp;quot; image at the left indicates that this service is a Database.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Pause&amp;quot; image indicates that the service currently stopped - click this will start the service, after which the image will change to a &amp;quot;tick&amp;quot;:&lt;br /&gt;
[[File:PRS Database Service - Running.png|none|thumb]]&lt;br /&gt;
Once the service is running, a &amp;quot;target&amp;quot; indicator will appear in the right-hand column - clicking this will display a debug console to allow you to monitor service activity:&lt;br /&gt;
[[File:PRS Database Console.png|none|thumb]]&lt;br /&gt;
Since this log is reset when the debug console is closed, a full log can be found in a log file which is saved to the &amp;quot;Local System&amp;quot; service account&#039;s AppData folder. On 64-bit Windows, this can be found under the &amp;quot;C:\Windows\SysWOW64\config\systemprofile\AppData\Roaming\PRSServer\PRSDatabase&amp;quot; folder as a &amp;quot;.log&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
Once the service is successfully running, you can move on to adding and configuring additional services as required:&lt;br /&gt;
&lt;br /&gt;
* Add an [[AutoDiscovery Service|Auto Discovery Service]] to allow client workstations to automatically find and connect to this database&lt;br /&gt;
*Add a [[GPS Gateway Service]] to capture incoming GPS data from Digital Matter IoT devices&lt;br /&gt;
*Add a [[Scheduling Service|Scheduler Service]] to perform regular actions on you database&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
	<entry>
		<id>https://prsdigital.com.au/wiki/index.php?title=Database_Service&amp;diff=68</id>
		<title>Database Service</title>
		<link rel="alternate" type="text/html" href="https://prsdigital.com.au/wiki/index.php?title=Database_Service&amp;diff=68"/>
		<updated>2022-06-21T08:20:18Z</updated>

		<summary type="html">&lt;p&gt;Kenric: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:PRS Database Service Account Settings.png|none|thumb]]&lt;br /&gt;
The PRS database service is the engine room of PRS, providing access to one or more PRS databases.  In most cases, only one main database is required - however, there may be circumstances (for instance, multiple divisions or companies using the same infrastructure) where more than one database service may be running at the same time.&lt;br /&gt;
&lt;br /&gt;
To add a database service, click the &amp;quot;Add Service&amp;quot; button at the bottom right of the screen, and select &amp;quot;Database&amp;quot;:&lt;br /&gt;
[[File:PRS Add Database.png|none|thumb]]&lt;br /&gt;
The Database Properties screen will appear, allowing you to customise the service as required:&lt;br /&gt;
[[File:PRS Database Service General Settings.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
* The &amp;quot;Name&amp;quot; field provides a description of the database, which can be automatically provided to clients if the AutoDiscovery Service is enabled&lt;br /&gt;
&lt;br /&gt;
* The &amp;quot;File Name&amp;quot; filed indicates the location of the (not-yet-created) database itself - click the &amp;quot;Select&amp;quot; button at the right to choose a location and file name for the database.  If you have an existing database file, you can select this here to use the existing data - it will not be overwritten or erased.&lt;br /&gt;
* The &amp;quot;Port&amp;quot; field indicates the TCP port that the database service will listen on for client requests.  This port should be configured to allow traffic through any firewalls you may have installed.&lt;br /&gt;
&lt;br /&gt;
To ensure that the service can be validly installed on your system, click on the &amp;quot;Account&amp;quot; tab, and enter the Domain, User name and Password  for an account that has privileges to install services on your system:&lt;br /&gt;
[[File:PRS Database Server Account Details.png|none|thumb]]&lt;br /&gt;
(If you are using a local account, use &amp;quot;.&amp;quot; as the Domain Name)&lt;br /&gt;
&lt;br /&gt;
At this point you should see the Database Service appear in the list of available services:&lt;br /&gt;
[[File:PRS Database Service Status.png|none|thumb]]&lt;br /&gt;
The &amp;quot;Disk&amp;quot; image at the left indicates that this service is a Database.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Pause&amp;quot; image indicates that the service currently stopped - click this will start the service, after which the image will change to a &amp;quot;tick&amp;quot;:&lt;br /&gt;
[[File:PRS Database Service - Running.png|none|thumb]]&lt;br /&gt;
Once the service is running, a &amp;quot;target&amp;quot; indicator will appear in the right-hand column - clicking this will display a debug console to allow you to monitor service activity:&lt;br /&gt;
[[File:PRS Database Console.png|none|thumb]]&lt;br /&gt;
This log file is saved to the &amp;quot;Local System&amp;quot; service account&#039;s AppData folder, which on 64-bit Windows can be found in the &amp;quot;C:\Windows\SysWOW64\config\systemprofile\AppData\Roaming\PRSServer\PRSDatabase&amp;quot; folder as a &amp;quot;.log&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
Once the service is successfully running, you can move on to adding and configuring additional services as required:&lt;br /&gt;
&lt;br /&gt;
* Add an [[AutoDiscovery Service|Auto Discovery Service]] to allow client workstations to automatically find and connect to this database&lt;br /&gt;
*Add a [[GPS Gateway Service]] to capture incoming GPS data from Digital Matter IoT devices&lt;br /&gt;
*Add a [[Scheduling Service|Scheduler Service]] to perform regular actions on you database&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Kenric</name></author>
	</entry>
</feed>