<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.tsnocode.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kpe</id>
	<title>TS NoCode wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tsnocode.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kpe"/>
	<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Special:Contributions/Kpe"/>
	<updated>2026-04-11T10:23:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.0</generator>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7301</id>
		<title>Course notes for today</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7301"/>
		<updated>2026-03-31T07:07:29Z</updated>

		<summary type="html">&lt;p&gt;Kpe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Slides for today ==&lt;br /&gt;
https://drive.google.com/file/d/1ITxiFH6gFjzd3FJUiX3gJN0YBJoW_4Zw/view?usp=sharing&lt;br /&gt;
&lt;br /&gt;
== Servers for today ==&lt;br /&gt;
&lt;br /&gt;
Servers &lt;br /&gt;
* https://trainingv3.tsnocode.com/ecit1/login Kasper&lt;br /&gt;
* https://trainingv3.tsnocode.com/ecit2/login Lea&lt;br /&gt;
* https://trainingv3.tsnocode.com/ecit3/login Gitte&lt;br /&gt;
* https://trainingv3.tsnocode.com/ecit4/login Berit&lt;br /&gt;
* https://trainingv3.tsnocode.com/ecit5/login Kristian&lt;br /&gt;
* https://trainingv3.tsnocode.com/ecit6/login Mike&lt;br /&gt;
&lt;br /&gt;
Credentials&lt;br /&gt;
* username: admin&lt;br /&gt;
* password: [on whiteboard]&lt;br /&gt;
&lt;br /&gt;
== Setting up DEV environment ==&lt;br /&gt;
Downloads&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/tsnocodeApi.jar&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/TempusServa.war&lt;br /&gt;
&lt;br /&gt;
For placement in the lib folder (ALL) &lt;br /&gt;
* https://www.tempusserva.dk/install/driver/mysql-connector-java-5.1.45-bin.jar&lt;br /&gt;
* https://www.tempusserva.dk/install/driver/commons-logging-1.1.1.jar&lt;br /&gt;
&lt;br /&gt;
== Related articles ==&lt;br /&gt;
* https://wiki.tempusserva.dk/index.php?title=Installation_Windows#MySQL_database&lt;br /&gt;
&lt;br /&gt;
Sample create user SQL &lt;br /&gt;
* CREATE USER 'tsinstall'@'*' IDENTIFIED BY 'TempusServa';&lt;br /&gt;
* GRANT ALL PRIVILEGES ON *.* TO 'tsinstall'@'*' WITH GRANT OPTION;&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7300</id>
		<title>Course notes for today</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7300"/>
		<updated>2026-03-31T07:00:17Z</updated>

		<summary type="html">&lt;p&gt;Kpe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Slides for today ==&lt;br /&gt;
https://www.tempusserva.dk/share/training/PFM100.pdf&lt;br /&gt;
&lt;br /&gt;
== Servers for today ==&lt;br /&gt;
&lt;br /&gt;
Servers &lt;br /&gt;
* https://trainingv3.tsnocode.com/ecit1/login Kasper&lt;br /&gt;
* https://trainingv3.tsnocode.com/ecit2/login Lea&lt;br /&gt;
* https://trainingv3.tsnocode.com/ecit3/login Gitte&lt;br /&gt;
* https://trainingv3.tsnocode.com/ecit4/login Berit&lt;br /&gt;
* https://trainingv3.tsnocode.com/ecit5/login Kristian&lt;br /&gt;
* https://trainingv3.tsnocode.com/ecit6/login Mike&lt;br /&gt;
&lt;br /&gt;
Credentials&lt;br /&gt;
* username: admin&lt;br /&gt;
* password: [on whiteboard]&lt;br /&gt;
&lt;br /&gt;
== Setting up DEV environment ==&lt;br /&gt;
Downloads&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/tsnocodeApi.jar&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/TempusServa.war&lt;br /&gt;
&lt;br /&gt;
For placement in the lib folder (ALL) &lt;br /&gt;
* https://www.tempusserva.dk/install/driver/mysql-connector-java-5.1.45-bin.jar&lt;br /&gt;
* https://www.tempusserva.dk/install/driver/commons-logging-1.1.1.jar&lt;br /&gt;
&lt;br /&gt;
== Related articles ==&lt;br /&gt;
* https://wiki.tempusserva.dk/index.php?title=Installation_Windows#MySQL_database&lt;br /&gt;
&lt;br /&gt;
Sample create user SQL &lt;br /&gt;
* CREATE USER 'tsinstall'@'*' IDENTIFIED BY 'TempusServa';&lt;br /&gt;
* GRANT ALL PRIVILEGES ON *.* TO 'tsinstall'@'*' WITH GRANT OPTION;&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7299</id>
		<title>Course notes for today</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7299"/>
		<updated>2025-12-10T08:05:51Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Slides for today */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Slides for today ==&lt;br /&gt;
https://www.tempusserva.dk/share/training/PFM100.pdf&lt;br /&gt;
&lt;br /&gt;
== Servers for today ==&lt;br /&gt;
&lt;br /&gt;
Servers &lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr1/login Micharl&lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr2/login Bo&lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr3/login Isabella&lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr4/login Maria&lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr5/login Kasper&lt;br /&gt;
&lt;br /&gt;
Credentials&lt;br /&gt;
* username: admin&lt;br /&gt;
* password: [on whiteboard]&lt;br /&gt;
&lt;br /&gt;
== Setting up DEV environment ==&lt;br /&gt;
Downloads&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/tsnocodeApi.jar&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/TempusServa.war&lt;br /&gt;
&lt;br /&gt;
For placement in the lib folder (ALL) &lt;br /&gt;
* https://www.tempusserva.dk/install/driver/mysql-connector-java-5.1.45-bin.jar&lt;br /&gt;
* https://www.tempusserva.dk/install/driver/commons-logging-1.1.1.jar&lt;br /&gt;
&lt;br /&gt;
== Related articles ==&lt;br /&gt;
* https://wiki.tempusserva.dk/index.php?title=Installation_Windows#MySQL_database&lt;br /&gt;
&lt;br /&gt;
Sample create user SQL &lt;br /&gt;
* CREATE USER 'tsinstall'@'*' IDENTIFIED BY 'TempusServa';&lt;br /&gt;
* GRANT ALL PRIVILEGES ON *.* TO 'tsinstall'@'*' WITH GRANT OPTION;&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7298</id>
		<title>Course notes for today</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7298"/>
		<updated>2025-12-10T07:59:07Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Servers for today */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Slides for today ==&lt;br /&gt;
https://www.tempusserva.dk/share/training/PFM300.pdf&lt;br /&gt;
&lt;br /&gt;
== Servers for today ==&lt;br /&gt;
&lt;br /&gt;
Servers &lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr1/login Micharl&lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr2/login Bo&lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr3/login Isabella&lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr4/login Maria&lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr5/login Kasper&lt;br /&gt;
&lt;br /&gt;
Credentials&lt;br /&gt;
* username: admin&lt;br /&gt;
* password: [on whiteboard]&lt;br /&gt;
&lt;br /&gt;
== Setting up DEV environment ==&lt;br /&gt;
Downloads&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/tsnocodeApi.jar&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/TempusServa.war&lt;br /&gt;
&lt;br /&gt;
For placement in the lib folder (ALL) &lt;br /&gt;
* https://www.tempusserva.dk/install/driver/mysql-connector-java-5.1.45-bin.jar&lt;br /&gt;
* https://www.tempusserva.dk/install/driver/commons-logging-1.1.1.jar&lt;br /&gt;
&lt;br /&gt;
== Related articles ==&lt;br /&gt;
* https://wiki.tempusserva.dk/index.php?title=Installation_Windows#MySQL_database&lt;br /&gt;
&lt;br /&gt;
Sample create user SQL &lt;br /&gt;
* CREATE USER 'tsinstall'@'*' IDENTIFIED BY 'TempusServa';&lt;br /&gt;
* GRANT ALL PRIVILEGES ON *.* TO 'tsinstall'@'*' WITH GRANT OPTION;&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7297</id>
		<title>Course notes for today</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7297"/>
		<updated>2025-12-09T15:34:35Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Servers for today */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Slides for today ==&lt;br /&gt;
https://www.tempusserva.dk/share/training/PFM300.pdf&lt;br /&gt;
&lt;br /&gt;
== Servers for today ==&lt;br /&gt;
&lt;br /&gt;
Servers &lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr1/login X&lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr2/login Y&lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr3/login Z&lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr4/login Æ&lt;br /&gt;
* https://trainingv3.tsnocode.com/hbr5/login Ø&lt;br /&gt;
&lt;br /&gt;
Credentials&lt;br /&gt;
* username: admin&lt;br /&gt;
* password: [on whiteboard]&lt;br /&gt;
&lt;br /&gt;
== Setting up DEV environment ==&lt;br /&gt;
Downloads&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/tsnocodeApi.jar&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/TempusServa.war&lt;br /&gt;
&lt;br /&gt;
For placement in the lib folder (ALL) &lt;br /&gt;
* https://www.tempusserva.dk/install/driver/mysql-connector-java-5.1.45-bin.jar&lt;br /&gt;
* https://www.tempusserva.dk/install/driver/commons-logging-1.1.1.jar&lt;br /&gt;
&lt;br /&gt;
== Related articles ==&lt;br /&gt;
* https://wiki.tempusserva.dk/index.php?title=Installation_Windows#MySQL_database&lt;br /&gt;
&lt;br /&gt;
Sample create user SQL &lt;br /&gt;
* CREATE USER 'tsinstall'@'*' IDENTIFIED BY 'TempusServa';&lt;br /&gt;
* GRANT ALL PRIVILEGES ON *.* TO 'tsinstall'@'*' WITH GRANT OPTION;&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Coding_standards&amp;diff=7294</id>
		<title>Coding standards</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Coding_standards&amp;diff=7294"/>
		<updated>2025-06-18T13:57:03Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Naming standards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Naming standards ==&lt;br /&gt;
&lt;br /&gt;
=== URL related naming ===&lt;br /&gt;
* Allways use lowercase for application naming&lt;br /&gt;
&lt;br /&gt;
=== Code naming standards ===&lt;br /&gt;
&lt;br /&gt;
==== Package / naming placement ====&lt;br /&gt;
* Package name all lowercase&lt;br /&gt;
* General platform entities&lt;br /&gt;
** Servlets: '''com.tsnocode.server.servlet'''&lt;br /&gt;
**Filters: '''com.tsnocode.server.filter'''&lt;br /&gt;
**Core: '''com.tsnocode.ui''' &lt;br /&gt;
** Fields: '''com.tsnocode.ui.field.&amp;lt;group&amp;gt;'''&lt;br /&gt;
** Views: '''com.tsnocode.ui.views.&amp;lt;type&amp;gt;  (item,list,statistics,)'''&lt;br /&gt;
**Codeunit: '''com.tsnocode.codeunit.common'''&lt;br /&gt;
* Solution specific code&lt;br /&gt;
** TS customer app: &lt;br /&gt;
*** '''com.tsnocode.solution.app'''&lt;br /&gt;
*** '''com.tsnocode.solution.customer'''&lt;br /&gt;
*** '''com.tsnocode.solution.customer.app'''&lt;br /&gt;
** Vendor app: &lt;br /&gt;
*** '''com.vendor.tsnocode.app'''&lt;br /&gt;
*** '''com.vendor.solution.app'''&lt;br /&gt;
&lt;br /&gt;
==== Class naming ====&lt;br /&gt;
Naming convention follows Java standard&lt;br /&gt;
* Starting with uppercase&lt;br /&gt;
* No special characters&lt;br /&gt;
* Seperate words with uppercase&lt;br /&gt;
&lt;br /&gt;
In addition the following are recommended&lt;br /&gt;
* CodeunitPage post fix name &amp;quot;Page&amp;quot;&lt;br /&gt;
* CodeunitService post fix name &amp;quot;Service&amp;quot;&lt;br /&gt;
* Shared ressources include &amp;quot;Helper&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Database naming standards ===&lt;br /&gt;
&lt;br /&gt;
==== Table naming ====&lt;br /&gt;
&lt;br /&gt;
System tables should follow this syntax&lt;br /&gt;
* lowercase&lt;br /&gt;
* no special characters&lt;br /&gt;
* singular form (cow, not cows)&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes include&lt;br /&gt;
* data_&lt;br /&gt;
* _data_ (deleted tables)&lt;br /&gt;
&lt;br /&gt;
==== Table attribute naming ====&lt;br /&gt;
General rules&lt;br /&gt;
* Starts uppercase&lt;br /&gt;
* Next word in name starts with uppercase (eg ThisIsAnExample)&lt;br /&gt;
* Foreign keys ends with ID (eg UserID)&lt;br /&gt;
&lt;br /&gt;
Changelog attributes fixed names&lt;br /&gt;
* CreatedAt&lt;br /&gt;
* CreatedBy&lt;br /&gt;
* ModifiedAt&lt;br /&gt;
* ModifiedBy&lt;br /&gt;
* FinalizedAt&lt;br /&gt;
* FinalizedBy&lt;br /&gt;
&lt;br /&gt;
== Compliance standards ==&lt;br /&gt;
The platform must be able to run on&lt;br /&gt;
* Current versions of Java&lt;br /&gt;
* Current versions of Tomcat&lt;br /&gt;
* MySQL and MariaDB&lt;br /&gt;
** Do not use current_timestamp (property)&lt;br /&gt;
&lt;br /&gt;
== Safety standards ==&lt;br /&gt;
* Input sanitization used in SQL, using either &lt;br /&gt;
** Escape all string parameters using DbConnection.EscapeSQL&lt;br /&gt;
** Prepared statements &lt;br /&gt;
* All Page codeunits should contain some user group restrictions, and set to be default off&lt;br /&gt;
&lt;br /&gt;
== Review standards ==&lt;br /&gt;
The following changes requires a formal code review&lt;br /&gt;
* Changes to the API&lt;br /&gt;
* Changes to common objects&lt;br /&gt;
** Command&lt;br /&gt;
** Security&lt;br /&gt;
** Controller&lt;br /&gt;
** DbConnection&lt;br /&gt;
* Creation of OR changes to&lt;br /&gt;
** Servlets&lt;br /&gt;
** Servlet Filters&lt;br /&gt;
** CodeunitPagePublic&lt;br /&gt;
** Code containing SQL&lt;br /&gt;
* Any code that&lt;br /&gt;
** Deletes DB columns OR tables&lt;br /&gt;
&lt;br /&gt;
== Test cases ==&lt;br /&gt;
&lt;br /&gt;
=== Test cases Fields ===&lt;br /&gt;
* Commands: list, show, edit (update)&lt;br /&gt;
* List interactions: Sort, Grouping&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7293</id>
		<title>Codeunit/Formevents</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7293"/>
		<updated>2025-06-18T12:52:29Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Form events fires different actions during execution of a solution&lt;br /&gt;
&lt;br /&gt;
== Creating the codeunit ==&lt;br /&gt;
# Make sure that '''p2eShared.jar''' is included in the project&lt;br /&gt;
# Create a new class that extends&lt;br /&gt;
&lt;br /&gt;
    com.tsnocode.codeunit.CodeunitFormevents&lt;br /&gt;
&lt;br /&gt;
== LIST level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendListPageHead() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
    public String appendListPageFoot() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectList() throws Exception {}    &lt;br /&gt;
    public void beforeRenderList() throws Exception {}       &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== LIST execution order ====&lt;br /&gt;
# '''beforeSelectList'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''listFilterActive &amp;gt; listFilterHandler'''&lt;br /&gt;
# '''beforeRenderList'''&lt;br /&gt;
# Return list to user&lt;br /&gt;
&lt;br /&gt;
== ITEM level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendItemPageHead() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
    public String appendItemPageFoot() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectItem() throws Exception {}    &lt;br /&gt;
    public void beforeChangeItem() throws Exception {}&lt;br /&gt;
    public void beforeUpdateItem() throws Exception {}&lt;br /&gt;
    public void beforeRenderItem() throws Exception {}    &lt;br /&gt;
    public void afterUpdateItem() throws Exception {   return false; }&lt;br /&gt;
    &lt;br /&gt;
    public boolean afterUpdateRedirectActive() {   return false; }&lt;br /&gt;
    public String afterUpdateRedirectContent()   {   return null;    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: viewing data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''itemFilterActive &amp;gt; itemFilterHandler'''&lt;br /&gt;
# '''beforeRenderItem'''&lt;br /&gt;
# Return form to user&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: posting data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
# '''beforeChangeItem'''&lt;br /&gt;
# Update field values&lt;br /&gt;
# '''beforeUpdateItem'''&lt;br /&gt;
# Write changes to database&lt;br /&gt;
# '''afterUpdateItem'''&lt;br /&gt;
# if NO OTHER ACTION: &lt;br /&gt;
#* '''afterUpdateRedirectActive'''&lt;br /&gt;
#* if TRUE&lt;br /&gt;
#** '''afterUpdateRedirectContent'''&lt;br /&gt;
# Return content to user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FILTER event hooks ==&lt;br /&gt;
Filters will help you build customized permission schemes. They are called for '''both''' LIST and ITEM commands.&lt;br /&gt;
&lt;br /&gt;
  dataFilterActive() {}&lt;br /&gt;
  dataFilterHandler(StringBuilder sql) {}&lt;br /&gt;
&lt;br /&gt;
In some cases you only want the filter to trigger for '''either''' LIST or ITEM commands&lt;br /&gt;
&lt;br /&gt;
  itemFilterActive() {}&lt;br /&gt;
  itemFilterHandler(StringBuilder sql) {}&lt;br /&gt;
&lt;br /&gt;
  listFilterActive() {}&lt;br /&gt;
  listFilterHandler(StringBuilder sql) {}&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
The xxxFilterActive tells if the filter is active&lt;br /&gt;
&lt;br /&gt;
  boolean dataFilterActive() { return ! s.isAdministor(); }&lt;br /&gt;
&lt;br /&gt;
The xxxFilterHandler modifies the SQL used to fetch data&lt;br /&gt;
&lt;br /&gt;
 void dataFilterHandler(StringBuilder sql) { sql.append(&amp;quot; AND CATEGORY NOT IN (123,456,789)&amp;quot;); }&lt;br /&gt;
&lt;br /&gt;
== Event firing details ==&lt;br /&gt;
&lt;br /&gt;
==== Event firing global ====&lt;br /&gt;
The following events are ALLWAYS fired&lt;br /&gt;
* beforeSelectList&lt;br /&gt;
* beforeSelectItem&lt;br /&gt;
* beforeChangeItem&lt;br /&gt;
* beforeUpdateItem&lt;br /&gt;
* afterUpdateItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI (reserved for normal users) ====&lt;br /&gt;
The following events will NOT be fired during imports etc.&lt;br /&gt;
* appendListPageHead&lt;br /&gt;
* appendListPageFoot&lt;br /&gt;
* beforeRenderList&lt;br /&gt;
* appendItemPageHead&lt;br /&gt;
* appendItemPageFoot&lt;br /&gt;
* beforeRenderItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI depending on user actions ====&lt;br /&gt;
The following events are SOMETIMES be fired for normal users depending on navigation&lt;br /&gt;
* afterUpdateRedirectActive&lt;br /&gt;
** Not executed in SUBFORM mode&lt;br /&gt;
** Not executed in during imports etc.&lt;br /&gt;
* afterUpdateRedirectContent&lt;br /&gt;
** Depends on a TRUE result from afterUpdateRedirectActive()&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7292</id>
		<title>Codeunit/Formevents</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7292"/>
		<updated>2025-06-18T12:52:20Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* FILTER event hooks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Form events fires different actions during execution of a solution&lt;br /&gt;
&lt;br /&gt;
== Creating the codeunit ==&lt;br /&gt;
# Make sure that '''p2eShared.jar''' is included in the project&lt;br /&gt;
# Create a new class that extends&lt;br /&gt;
&lt;br /&gt;
    com.tsnocode.codeunit.CodeunitFormevents&lt;br /&gt;
&lt;br /&gt;
== LIST level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendListPageHead() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
    public String appendListPageFoot() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectList() throws Exception {}    &lt;br /&gt;
    public void beforeRenderList() throws Exception {}       &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== LIST execution order ====&lt;br /&gt;
# '''beforeSelectList'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''listFilterActive &amp;gt; listFilterHandler'''&lt;br /&gt;
# '''beforeRenderList'''&lt;br /&gt;
# Return list to user&lt;br /&gt;
&lt;br /&gt;
== ITEM level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendItemPageHead() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
    public String appendItemPageFoot() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectItem() throws Exception {}    &lt;br /&gt;
    public void beforeChangeItem() throws Exception {}&lt;br /&gt;
    public void beforeUpdateItem() throws Exception {}&lt;br /&gt;
    public void beforeRenderItem() throws Exception {}    &lt;br /&gt;
    public void afterUpdateItem() throws Exception {   return false; }&lt;br /&gt;
    &lt;br /&gt;
    public boolean afterUpdateRedirectActive() {   return false; }&lt;br /&gt;
    public String afterUpdateRedirectContent()   {   return null;    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: viewing data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''itemFilterActive &amp;gt; itemFilterHandler'''&lt;br /&gt;
# '''beforeRenderItem'''&lt;br /&gt;
# Return form to user&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: posting data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
# '''beforeChangeItem'''&lt;br /&gt;
# Update field values&lt;br /&gt;
# '''beforeUpdateItem'''&lt;br /&gt;
# Write changes to database&lt;br /&gt;
# '''afterUpdateItem'''&lt;br /&gt;
# if NO OTHER ACTION: &lt;br /&gt;
#* '''afterUpdateRedirectActive'''&lt;br /&gt;
#* if TRUE&lt;br /&gt;
#** '''afterUpdateRedirectContent'''&lt;br /&gt;
# Return content to user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FILTER event hooks ==&lt;br /&gt;
Filters will help you build customized permission schemes. They are called for '''both''' LIST and ITEM commands.&lt;br /&gt;
&lt;br /&gt;
  dataFilterActive() {}&lt;br /&gt;
  dataFilterHandler(StringBuilder sql) {}&lt;br /&gt;
&lt;br /&gt;
In some cases you only want the filter to trigger for '''either''' LIST or ITEM commands&lt;br /&gt;
&lt;br /&gt;
  itemFilterActive() {}&lt;br /&gt;
  itemFilterHandler(StringBuilder sql) {}&lt;br /&gt;
&lt;br /&gt;
  listFilterActive() {}&lt;br /&gt;
  listFilterHandler(StringBuilder sql) {}&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
The xxxFilterActive tells if the filter is active&lt;br /&gt;
&lt;br /&gt;
  boolean dataFilterActive() { return ! s.isAdministor(); }&lt;br /&gt;
 &lt;br /&gt;
The xxxFilterHandler modifies the SQL used to fetch data&lt;br /&gt;
&lt;br /&gt;
 void dataFilterHandler(StringBuilder sql) { sql.append(&amp;quot; AND CATEGORY NOT IN (123,456,789)&amp;quot;); }&lt;br /&gt;
&lt;br /&gt;
== Event firing details ==&lt;br /&gt;
&lt;br /&gt;
==== Event firing global ====&lt;br /&gt;
The following events are ALLWAYS fired&lt;br /&gt;
* beforeSelectList&lt;br /&gt;
* beforeSelectItem&lt;br /&gt;
* beforeChangeItem&lt;br /&gt;
* beforeUpdateItem&lt;br /&gt;
* afterUpdateItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI (reserved for normal users) ====&lt;br /&gt;
The following events will NOT be fired during imports etc.&lt;br /&gt;
* appendListPageHead&lt;br /&gt;
* appendListPageFoot&lt;br /&gt;
* beforeRenderList&lt;br /&gt;
* appendItemPageHead&lt;br /&gt;
* appendItemPageFoot&lt;br /&gt;
* beforeRenderItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI depending on user actions ====&lt;br /&gt;
The following events are SOMETIMES be fired for normal users depending on navigation&lt;br /&gt;
* afterUpdateRedirectActive&lt;br /&gt;
** Not executed in SUBFORM mode&lt;br /&gt;
** Not executed in during imports etc.&lt;br /&gt;
* afterUpdateRedirectContent&lt;br /&gt;
** Depends on a TRUE result from afterUpdateRedirectActive()&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7291</id>
		<title>Codeunit/Formevents</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7291"/>
		<updated>2025-06-18T12:44:18Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* FILTER event hooks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Form events fires different actions during execution of a solution&lt;br /&gt;
&lt;br /&gt;
== Creating the codeunit ==&lt;br /&gt;
# Make sure that '''p2eShared.jar''' is included in the project&lt;br /&gt;
# Create a new class that extends&lt;br /&gt;
&lt;br /&gt;
    com.tsnocode.codeunit.CodeunitFormevents&lt;br /&gt;
&lt;br /&gt;
== LIST level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendListPageHead() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
    public String appendListPageFoot() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectList() throws Exception {}    &lt;br /&gt;
    public void beforeRenderList() throws Exception {}       &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== LIST execution order ====&lt;br /&gt;
# '''beforeSelectList'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''listFilterActive &amp;gt; listFilterHandler'''&lt;br /&gt;
# '''beforeRenderList'''&lt;br /&gt;
# Return list to user&lt;br /&gt;
&lt;br /&gt;
== ITEM level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendItemPageHead() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
    public String appendItemPageFoot() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectItem() throws Exception {}    &lt;br /&gt;
    public void beforeChangeItem() throws Exception {}&lt;br /&gt;
    public void beforeUpdateItem() throws Exception {}&lt;br /&gt;
    public void beforeRenderItem() throws Exception {}    &lt;br /&gt;
    public void afterUpdateItem() throws Exception {   return false; }&lt;br /&gt;
    &lt;br /&gt;
    public boolean afterUpdateRedirectActive() {   return false; }&lt;br /&gt;
    public String afterUpdateRedirectContent()   {   return null;    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: viewing data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''itemFilterActive &amp;gt; itemFilterHandler'''&lt;br /&gt;
# '''beforeRenderItem'''&lt;br /&gt;
# Return form to user&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: posting data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
# '''beforeChangeItem'''&lt;br /&gt;
# Update field values&lt;br /&gt;
# '''beforeUpdateItem'''&lt;br /&gt;
# Write changes to database&lt;br /&gt;
# '''afterUpdateItem'''&lt;br /&gt;
# if NO OTHER ACTION: &lt;br /&gt;
#* '''afterUpdateRedirectActive'''&lt;br /&gt;
#* if TRUE&lt;br /&gt;
#** '''afterUpdateRedirectContent'''&lt;br /&gt;
# Return content to user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FILTER event hooks ==&lt;br /&gt;
Filters will help you build customized permission schemes. They are called for '''both''' LIST and ITEM commands.&lt;br /&gt;
&lt;br /&gt;
  dataFilterActive() {}&lt;br /&gt;
  dataFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
In some cases you only want the filter to trigger for '''either''' LIST or ITEM commands&lt;br /&gt;
&lt;br /&gt;
  itemFilterActive() {}&lt;br /&gt;
  itemFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
  listFilterActive() {}&lt;br /&gt;
  listFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
== Event firing details ==&lt;br /&gt;
&lt;br /&gt;
==== Event firing global ====&lt;br /&gt;
The following events are ALLWAYS fired&lt;br /&gt;
* beforeSelectList&lt;br /&gt;
* beforeSelectItem&lt;br /&gt;
* beforeChangeItem&lt;br /&gt;
* beforeUpdateItem&lt;br /&gt;
* afterUpdateItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI (reserved for normal users) ====&lt;br /&gt;
The following events will NOT be fired during imports etc.&lt;br /&gt;
* appendListPageHead&lt;br /&gt;
* appendListPageFoot&lt;br /&gt;
* beforeRenderList&lt;br /&gt;
* appendItemPageHead&lt;br /&gt;
* appendItemPageFoot&lt;br /&gt;
* beforeRenderItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI depending on user actions ====&lt;br /&gt;
The following events are SOMETIMES be fired for normal users depending on navigation&lt;br /&gt;
* afterUpdateRedirectActive&lt;br /&gt;
** Not executed in SUBFORM mode&lt;br /&gt;
** Not executed in during imports etc.&lt;br /&gt;
* afterUpdateRedirectContent&lt;br /&gt;
** Depends on a TRUE result from afterUpdateRedirectActive()&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7290</id>
		<title>Codeunit/Formevents</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7290"/>
		<updated>2025-06-18T12:44:05Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* FILTER event hooks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Form events fires different actions during execution of a solution&lt;br /&gt;
&lt;br /&gt;
== Creating the codeunit ==&lt;br /&gt;
# Make sure that '''p2eShared.jar''' is included in the project&lt;br /&gt;
# Create a new class that extends&lt;br /&gt;
&lt;br /&gt;
    com.tsnocode.codeunit.CodeunitFormevents&lt;br /&gt;
&lt;br /&gt;
== LIST level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendListPageHead() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
    public String appendListPageFoot() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectList() throws Exception {}    &lt;br /&gt;
    public void beforeRenderList() throws Exception {}       &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== LIST execution order ====&lt;br /&gt;
# '''beforeSelectList'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''listFilterActive &amp;gt; listFilterHandler'''&lt;br /&gt;
# '''beforeRenderList'''&lt;br /&gt;
# Return list to user&lt;br /&gt;
&lt;br /&gt;
== ITEM level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendItemPageHead() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
    public String appendItemPageFoot() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectItem() throws Exception {}    &lt;br /&gt;
    public void beforeChangeItem() throws Exception {}&lt;br /&gt;
    public void beforeUpdateItem() throws Exception {}&lt;br /&gt;
    public void beforeRenderItem() throws Exception {}    &lt;br /&gt;
    public void afterUpdateItem() throws Exception {   return false; }&lt;br /&gt;
    &lt;br /&gt;
    public boolean afterUpdateRedirectActive() {   return false; }&lt;br /&gt;
    public String afterUpdateRedirectContent()   {   return null;    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: viewing data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''itemFilterActive &amp;gt; itemFilterHandler'''&lt;br /&gt;
# '''beforeRenderItem'''&lt;br /&gt;
# Return form to user&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: posting data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
# '''beforeChangeItem'''&lt;br /&gt;
# Update field values&lt;br /&gt;
# '''beforeUpdateItem'''&lt;br /&gt;
# Write changes to database&lt;br /&gt;
# '''afterUpdateItem'''&lt;br /&gt;
# if NO OTHER ACTION: &lt;br /&gt;
#* '''afterUpdateRedirectActive'''&lt;br /&gt;
#* if TRUE&lt;br /&gt;
#** '''afterUpdateRedirectContent'''&lt;br /&gt;
# Return content to user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FILTER event hooks ==&lt;br /&gt;
Filters will help you build customized permission schemes. They are called for '''both''' LIST and ITEM commands.&lt;br /&gt;
&lt;br /&gt;
  dataFilterActive() {}&lt;br /&gt;
  dataFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
In some cases you only want the filter to trigger for '''either''' LIST or ITEM commands&lt;br /&gt;
&lt;br /&gt;
  itemFilterActive() {}&lt;br /&gt;
  itemFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
  listFilterActive() {}&lt;br /&gt;
  listFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
== Event firing details ==&lt;br /&gt;
&lt;br /&gt;
==== Event firing global ====&lt;br /&gt;
The following events are ALLWAYS fired&lt;br /&gt;
* beforeSelectList&lt;br /&gt;
* beforeSelectItem&lt;br /&gt;
* beforeChangeItem&lt;br /&gt;
* beforeUpdateItem&lt;br /&gt;
* afterUpdateItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI (reserved for normal users) ====&lt;br /&gt;
The following events will NOT be fired during imports etc.&lt;br /&gt;
* appendListPageHead&lt;br /&gt;
* appendListPageFoot&lt;br /&gt;
* beforeRenderList&lt;br /&gt;
* appendItemPageHead&lt;br /&gt;
* appendItemPageFoot&lt;br /&gt;
* beforeRenderItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI depending on user actions ====&lt;br /&gt;
The following events are SOMETIMES be fired for normal users depending on navigation&lt;br /&gt;
* afterUpdateRedirectActive&lt;br /&gt;
** Not executed in SUBFORM mode&lt;br /&gt;
** Not executed in during imports etc.&lt;br /&gt;
* afterUpdateRedirectContent&lt;br /&gt;
** Depends on a TRUE result from afterUpdateRedirectActive()&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7289</id>
		<title>Codeunit/Formevents</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7289"/>
		<updated>2025-06-18T12:43:17Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* LIST execution order */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Form events fires different actions during execution of a solution&lt;br /&gt;
&lt;br /&gt;
== Creating the codeunit ==&lt;br /&gt;
# Make sure that '''p2eShared.jar''' is included in the project&lt;br /&gt;
# Create a new class that extends&lt;br /&gt;
&lt;br /&gt;
    com.tsnocode.codeunit.CodeunitFormevents&lt;br /&gt;
&lt;br /&gt;
== LIST level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendListPageHead() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
    public String appendListPageFoot() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectList() throws Exception {}    &lt;br /&gt;
    public void beforeRenderList() throws Exception {}       &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== LIST execution order ====&lt;br /&gt;
# '''beforeSelectList'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''listFilterActive &amp;gt; listFilterHandler'''&lt;br /&gt;
# '''beforeRenderList'''&lt;br /&gt;
# Return list to user&lt;br /&gt;
&lt;br /&gt;
== ITEM level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendItemPageHead() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
    public String appendItemPageFoot() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectItem() throws Exception {}    &lt;br /&gt;
    public void beforeChangeItem() throws Exception {}&lt;br /&gt;
    public void beforeUpdateItem() throws Exception {}&lt;br /&gt;
    public void beforeRenderItem() throws Exception {}    &lt;br /&gt;
    public void afterUpdateItem() throws Exception {   return false; }&lt;br /&gt;
    &lt;br /&gt;
    public boolean afterUpdateRedirectActive() {   return false; }&lt;br /&gt;
    public String afterUpdateRedirectContent()   {   return null;    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: viewing data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''itemFilterActive &amp;gt; itemFilterHandler'''&lt;br /&gt;
# '''beforeRenderItem'''&lt;br /&gt;
# Return form to user&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: posting data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
# '''beforeChangeItem'''&lt;br /&gt;
# Update field values&lt;br /&gt;
# '''beforeUpdateItem'''&lt;br /&gt;
# Write changes to database&lt;br /&gt;
# '''afterUpdateItem'''&lt;br /&gt;
# if NO OTHER ACTION: &lt;br /&gt;
#* '''afterUpdateRedirectActive'''&lt;br /&gt;
#* if TRUE&lt;br /&gt;
#** '''afterUpdateRedirectContent'''&lt;br /&gt;
# Return content to user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FILTER event hooks ==&lt;br /&gt;
Filters will help you build customized permission schemes&lt;br /&gt;
&lt;br /&gt;
  dataFilterActive() {}&lt;br /&gt;
  dataFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
In some cases you only want the filter to trigger for either LIST or ITEM commands&lt;br /&gt;
&lt;br /&gt;
  itemFilterActive() {}&lt;br /&gt;
  itemFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
  listFilterActive() {}&lt;br /&gt;
  listFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
== Event firing details ==&lt;br /&gt;
&lt;br /&gt;
==== Event firing global ====&lt;br /&gt;
The following events are ALLWAYS fired&lt;br /&gt;
* beforeSelectList&lt;br /&gt;
* beforeSelectItem&lt;br /&gt;
* beforeChangeItem&lt;br /&gt;
* beforeUpdateItem&lt;br /&gt;
* afterUpdateItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI (reserved for normal users) ====&lt;br /&gt;
The following events will NOT be fired during imports etc.&lt;br /&gt;
* appendListPageHead&lt;br /&gt;
* appendListPageFoot&lt;br /&gt;
* beforeRenderList&lt;br /&gt;
* appendItemPageHead&lt;br /&gt;
* appendItemPageFoot&lt;br /&gt;
* beforeRenderItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI depending on user actions ====&lt;br /&gt;
The following events are SOMETIMES be fired for normal users depending on navigation&lt;br /&gt;
* afterUpdateRedirectActive&lt;br /&gt;
** Not executed in SUBFORM mode&lt;br /&gt;
** Not executed in during imports etc.&lt;br /&gt;
* afterUpdateRedirectContent&lt;br /&gt;
** Depends on a TRUE result from afterUpdateRedirectActive()&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7288</id>
		<title>Codeunit/Formevents</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7288"/>
		<updated>2025-06-18T12:42:43Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* LIST execution order */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Form events fires different actions during execution of a solution&lt;br /&gt;
&lt;br /&gt;
== Creating the codeunit ==&lt;br /&gt;
# Make sure that '''p2eShared.jar''' is included in the project&lt;br /&gt;
# Create a new class that extends&lt;br /&gt;
&lt;br /&gt;
    com.tsnocode.codeunit.CodeunitFormevents&lt;br /&gt;
&lt;br /&gt;
== LIST level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendListPageHead() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
    public String appendListPageFoot() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectList() throws Exception {}    &lt;br /&gt;
    public void beforeRenderList() throws Exception {}       &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== LIST execution order ====&lt;br /&gt;
# '''beforeSelectList'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''itemFilterActive &amp;gt; itemFilterHandler'''&lt;br /&gt;
# '''beforeRenderList'''&lt;br /&gt;
# Return list to user&lt;br /&gt;
&lt;br /&gt;
== ITEM level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendItemPageHead() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
    public String appendItemPageFoot() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectItem() throws Exception {}    &lt;br /&gt;
    public void beforeChangeItem() throws Exception {}&lt;br /&gt;
    public void beforeUpdateItem() throws Exception {}&lt;br /&gt;
    public void beforeRenderItem() throws Exception {}    &lt;br /&gt;
    public void afterUpdateItem() throws Exception {   return false; }&lt;br /&gt;
    &lt;br /&gt;
    public boolean afterUpdateRedirectActive() {   return false; }&lt;br /&gt;
    public String afterUpdateRedirectContent()   {   return null;    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: viewing data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''itemFilterActive &amp;gt; itemFilterHandler'''&lt;br /&gt;
# '''beforeRenderItem'''&lt;br /&gt;
# Return form to user&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: posting data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
# '''beforeChangeItem'''&lt;br /&gt;
# Update field values&lt;br /&gt;
# '''beforeUpdateItem'''&lt;br /&gt;
# Write changes to database&lt;br /&gt;
# '''afterUpdateItem'''&lt;br /&gt;
# if NO OTHER ACTION: &lt;br /&gt;
#* '''afterUpdateRedirectActive'''&lt;br /&gt;
#* if TRUE&lt;br /&gt;
#** '''afterUpdateRedirectContent'''&lt;br /&gt;
# Return content to user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FILTER event hooks ==&lt;br /&gt;
Filters will help you build customized permission schemes&lt;br /&gt;
&lt;br /&gt;
  dataFilterActive() {}&lt;br /&gt;
  dataFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
In some cases you only want the filter to trigger for either LIST or ITEM commands&lt;br /&gt;
&lt;br /&gt;
  itemFilterActive() {}&lt;br /&gt;
  itemFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
  listFilterActive() {}&lt;br /&gt;
  listFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
== Event firing details ==&lt;br /&gt;
&lt;br /&gt;
==== Event firing global ====&lt;br /&gt;
The following events are ALLWAYS fired&lt;br /&gt;
* beforeSelectList&lt;br /&gt;
* beforeSelectItem&lt;br /&gt;
* beforeChangeItem&lt;br /&gt;
* beforeUpdateItem&lt;br /&gt;
* afterUpdateItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI (reserved for normal users) ====&lt;br /&gt;
The following events will NOT be fired during imports etc.&lt;br /&gt;
* appendListPageHead&lt;br /&gt;
* appendListPageFoot&lt;br /&gt;
* beforeRenderList&lt;br /&gt;
* appendItemPageHead&lt;br /&gt;
* appendItemPageFoot&lt;br /&gt;
* beforeRenderItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI depending on user actions ====&lt;br /&gt;
The following events are SOMETIMES be fired for normal users depending on navigation&lt;br /&gt;
* afterUpdateRedirectActive&lt;br /&gt;
** Not executed in SUBFORM mode&lt;br /&gt;
** Not executed in during imports etc.&lt;br /&gt;
* afterUpdateRedirectContent&lt;br /&gt;
** Depends on a TRUE result from afterUpdateRedirectActive()&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7287</id>
		<title>Codeunit/Formevents</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7287"/>
		<updated>2025-06-18T12:42:10Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* ITEM execution order: viewing data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Form events fires different actions during execution of a solution&lt;br /&gt;
&lt;br /&gt;
== Creating the codeunit ==&lt;br /&gt;
# Make sure that '''p2eShared.jar''' is included in the project&lt;br /&gt;
# Create a new class that extends&lt;br /&gt;
&lt;br /&gt;
    com.tsnocode.codeunit.CodeunitFormevents&lt;br /&gt;
&lt;br /&gt;
== LIST level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendListPageHead() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
    public String appendListPageFoot() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectList() throws Exception {}    &lt;br /&gt;
    public void beforeRenderList() throws Exception {}       &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== LIST execution order ====&lt;br /&gt;
# '''beforeSelectList'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
# '''beforeRenderList'''&lt;br /&gt;
# Return list to user&lt;br /&gt;
&lt;br /&gt;
== ITEM level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendItemPageHead() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
    public String appendItemPageFoot() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectItem() throws Exception {}    &lt;br /&gt;
    public void beforeChangeItem() throws Exception {}&lt;br /&gt;
    public void beforeUpdateItem() throws Exception {}&lt;br /&gt;
    public void beforeRenderItem() throws Exception {}    &lt;br /&gt;
    public void afterUpdateItem() throws Exception {   return false; }&lt;br /&gt;
    &lt;br /&gt;
    public boolean afterUpdateRedirectActive() {   return false; }&lt;br /&gt;
    public String afterUpdateRedirectContent()   {   return null;    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: viewing data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* '''dataFilterActive &amp;gt; dataFilterHandler'''&lt;br /&gt;
#* '''itemFilterActive &amp;gt; itemFilterHandler'''&lt;br /&gt;
# '''beforeRenderItem'''&lt;br /&gt;
# Return form to user&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: posting data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
# '''beforeChangeItem'''&lt;br /&gt;
# Update field values&lt;br /&gt;
# '''beforeUpdateItem'''&lt;br /&gt;
# Write changes to database&lt;br /&gt;
# '''afterUpdateItem'''&lt;br /&gt;
# if NO OTHER ACTION: &lt;br /&gt;
#* '''afterUpdateRedirectActive'''&lt;br /&gt;
#* if TRUE&lt;br /&gt;
#** '''afterUpdateRedirectContent'''&lt;br /&gt;
# Return content to user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FILTER event hooks ==&lt;br /&gt;
Filters will help you build customized permission schemes&lt;br /&gt;
&lt;br /&gt;
  dataFilterActive() {}&lt;br /&gt;
  dataFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
In some cases you only want the filter to trigger for either LIST or ITEM commands&lt;br /&gt;
&lt;br /&gt;
  itemFilterActive() {}&lt;br /&gt;
  itemFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
  listFilterActive() {}&lt;br /&gt;
  listFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
== Event firing details ==&lt;br /&gt;
&lt;br /&gt;
==== Event firing global ====&lt;br /&gt;
The following events are ALLWAYS fired&lt;br /&gt;
* beforeSelectList&lt;br /&gt;
* beforeSelectItem&lt;br /&gt;
* beforeChangeItem&lt;br /&gt;
* beforeUpdateItem&lt;br /&gt;
* afterUpdateItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI (reserved for normal users) ====&lt;br /&gt;
The following events will NOT be fired during imports etc.&lt;br /&gt;
* appendListPageHead&lt;br /&gt;
* appendListPageFoot&lt;br /&gt;
* beforeRenderList&lt;br /&gt;
* appendItemPageHead&lt;br /&gt;
* appendItemPageFoot&lt;br /&gt;
* beforeRenderItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI depending on user actions ====&lt;br /&gt;
The following events are SOMETIMES be fired for normal users depending on navigation&lt;br /&gt;
* afterUpdateRedirectActive&lt;br /&gt;
** Not executed in SUBFORM mode&lt;br /&gt;
** Not executed in during imports etc.&lt;br /&gt;
* afterUpdateRedirectContent&lt;br /&gt;
** Depends on a TRUE result from afterUpdateRedirectActive()&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7286</id>
		<title>Codeunit/Formevents</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Codeunit/Formevents&amp;diff=7286"/>
		<updated>2025-06-18T12:41:18Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* ITEM execution order: viewing data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Form events fires different actions during execution of a solution&lt;br /&gt;
&lt;br /&gt;
== Creating the codeunit ==&lt;br /&gt;
# Make sure that '''p2eShared.jar''' is included in the project&lt;br /&gt;
# Create a new class that extends&lt;br /&gt;
&lt;br /&gt;
    com.tsnocode.codeunit.CodeunitFormevents&lt;br /&gt;
&lt;br /&gt;
== LIST level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendListPageHead() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
    public String appendListPageFoot() { return &amp;quot;&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectList() throws Exception {}    &lt;br /&gt;
    public void beforeRenderList() throws Exception {}       &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== LIST execution order ====&lt;br /&gt;
# '''beforeSelectList'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
# '''beforeRenderList'''&lt;br /&gt;
# Return list to user&lt;br /&gt;
&lt;br /&gt;
== ITEM level event hooks ==&lt;br /&gt;
&lt;br /&gt;
    public String appendItemPageHead() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
    public String appendItemPageFoot() { return &amp;quot;&amp;quot;; }    &lt;br /&gt;
&lt;br /&gt;
    public void beforeSelectItem() throws Exception {}    &lt;br /&gt;
    public void beforeChangeItem() throws Exception {}&lt;br /&gt;
    public void beforeUpdateItem() throws Exception {}&lt;br /&gt;
    public void beforeRenderItem() throws Exception {}    &lt;br /&gt;
    public void afterUpdateItem() throws Exception {   return false; }&lt;br /&gt;
    &lt;br /&gt;
    public boolean afterUpdateRedirectActive() {   return false; }&lt;br /&gt;
    public String afterUpdateRedirectContent()   {   return null;    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: viewing data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
#* dataFilterActive -&amp;gt; dataFilter&lt;br /&gt;
#* itemFilterActive -&amp;gt; dataFilter&lt;br /&gt;
# '''beforeRenderItem'''&lt;br /&gt;
# Return form to user&lt;br /&gt;
&lt;br /&gt;
==== ITEM execution order: posting data ====&lt;br /&gt;
# '''beforeSelectItem'''&lt;br /&gt;
# Gather form data from database&lt;br /&gt;
# '''beforeChangeItem'''&lt;br /&gt;
# Update field values&lt;br /&gt;
# '''beforeUpdateItem'''&lt;br /&gt;
# Write changes to database&lt;br /&gt;
# '''afterUpdateItem'''&lt;br /&gt;
# if NO OTHER ACTION: &lt;br /&gt;
#* '''afterUpdateRedirectActive'''&lt;br /&gt;
#* if TRUE&lt;br /&gt;
#** '''afterUpdateRedirectContent'''&lt;br /&gt;
# Return content to user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FILTER event hooks ==&lt;br /&gt;
Filters will help you build customized permission schemes&lt;br /&gt;
&lt;br /&gt;
  dataFilterActive() {}&lt;br /&gt;
  dataFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
In some cases you only want the filter to trigger for either LIST or ITEM commands&lt;br /&gt;
&lt;br /&gt;
  itemFilterActive() {}&lt;br /&gt;
  itemFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
  listFilterActive() {}&lt;br /&gt;
  listFilterHandler(StringBuilder sql) { return sql; }&lt;br /&gt;
&lt;br /&gt;
== Event firing details ==&lt;br /&gt;
&lt;br /&gt;
==== Event firing global ====&lt;br /&gt;
The following events are ALLWAYS fired&lt;br /&gt;
* beforeSelectList&lt;br /&gt;
* beforeSelectItem&lt;br /&gt;
* beforeChangeItem&lt;br /&gt;
* beforeUpdateItem&lt;br /&gt;
* afterUpdateItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI (reserved for normal users) ====&lt;br /&gt;
The following events will NOT be fired during imports etc.&lt;br /&gt;
* appendListPageHead&lt;br /&gt;
* appendListPageFoot&lt;br /&gt;
* beforeRenderList&lt;br /&gt;
* appendItemPageHead&lt;br /&gt;
* appendItemPageFoot&lt;br /&gt;
* beforeRenderItem&lt;br /&gt;
&lt;br /&gt;
==== Event firing in UI depending on user actions ====&lt;br /&gt;
The following events are SOMETIMES be fired for normal users depending on navigation&lt;br /&gt;
* afterUpdateRedirectActive&lt;br /&gt;
** Not executed in SUBFORM mode&lt;br /&gt;
** Not executed in during imports etc.&lt;br /&gt;
* afterUpdateRedirectContent&lt;br /&gt;
** Depends on a TRUE result from afterUpdateRedirectActive()&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=FieldFiles&amp;diff=7285</id>
		<title>FieldFiles</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=FieldFiles&amp;diff=7285"/>
		<updated>2025-06-18T11:16:32Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Documents */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Documents =&lt;br /&gt;
Upload / download of files including versioning&lt;br /&gt;
&lt;br /&gt;
Properties&lt;br /&gt;
* Type: [[Field type reference#Files|Files]]&lt;br /&gt;
* Groupable: No&lt;br /&gt;
* Show in lists: Yes&lt;br /&gt;
* Searchable: Yes&lt;br /&gt;
&lt;br /&gt;
Note that a class is added to the page while uploading ressources: '''uploadInProgress'''&lt;br /&gt;
&lt;br /&gt;
In case you want to prevent the user presing update, the buttons can be hided with this CSS&lt;br /&gt;
&lt;br /&gt;
  .uploadInProgress .tsUpdateButtons { display: none; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User interface ==&lt;br /&gt;
Field in show mode&lt;br /&gt;
&lt;br /&gt;
[[File:FieldFiles_show.png]]&lt;br /&gt;
&lt;br /&gt;
Field in edit mode&lt;br /&gt;
&lt;br /&gt;
[[File:FieldFiles_edit.png]]&lt;br /&gt;
&lt;br /&gt;
User interface as displayed in picture&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
No configuration required for this field type&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Developer info ==&lt;br /&gt;
* FeltTypeID: 50&lt;br /&gt;
* SQL datatype: int(11)&lt;br /&gt;
* Class name: FieldFiles&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7284</id>
		<title>JavaScript functions v1.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7284"/>
		<updated>2025-06-11T13:58:55Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Server code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;amp;nbsp;&lt;br /&gt;
= Code placement =&lt;br /&gt;
The following places can contain JS code&lt;br /&gt;
* Entity header&lt;br /&gt;
* Entity status&lt;br /&gt;
* JavaScript field&lt;br /&gt;
&lt;br /&gt;
Additionally HTML with inline script can be placed in&lt;br /&gt;
* Wrapper&lt;br /&gt;
* Template&lt;br /&gt;
&lt;br /&gt;
Finally expressions can be evaluated using&lt;br /&gt;
* Entity field dependency&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
= Builtin functions =&lt;br /&gt;
The following functions are only available for single item views (edit or show).&lt;br /&gt;
&lt;br /&gt;
== Get and set values ==&lt;br /&gt;
Display values are handled using standard getter and setters&lt;br /&gt;
* '''getValue(fieldName) '''&lt;br /&gt;
* '''setValue(fieldName,value) '''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let a = getValue(&amp;quot;NUMBER1&amp;quot;);&lt;br /&gt;
let b = getValue(&amp;quot;NUMBER2&amp;quot;);&lt;br /&gt;
setValue( &amp;quot;RESULT&amp;quot;, (a-b) );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For explicitly getting a value (or ID) use&lt;br /&gt;
* '''getDecimal(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let recordId = getDecimal(&amp;quot;SELECTRECORD&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Toggling fields (5478+) ==&lt;br /&gt;
Note: Hide functions are NOT intended for denying access to data -it will only be hidden in the frontend, but is still accessible to savvy users.&lt;br /&gt;
&lt;br /&gt;
Fields can be  shown or hidden calling the fieldname&lt;br /&gt;
* '''hideField(fieldName)'''&lt;br /&gt;
* '''showField(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;USER&amp;quot;);&lt;br /&gt;
hideField(&amp;quot;StatusID&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Dependent toggling ===&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage&lt;br /&gt;
* '''hideFieldForPageClass(fieldName,className)'''&lt;br /&gt;
* '''showFieldForPageClass(fieldName,className)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on items current status.&lt;br /&gt;
* '''hideFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
* '''showFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage AND items current status.&lt;br /&gt;
* '''hideFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
*'''showFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
&lt;br /&gt;
In case of advanced setup consider &amp;quot;hide for all first and show for some later&amp;quot;.&lt;br /&gt;
In this example NAME should only be displayed for a few status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;NAME&amp;quot;);   &lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1234);&lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1235);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Disclaimer ===&lt;br /&gt;
The functions are the equivilant of JQuery &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that fields are expected to be wrapped in TWO layers of html tags for the functions to work&lt;br /&gt;
&lt;br /&gt;
== Toggling status ==&lt;br /&gt;
A convenience method is planned for version 7800. Untill then you can use a Jquery expression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(&amp;quot;#DATA_StatusID option[value='123']&amp;quot;).remove();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Binding to events (6734+)==&lt;br /&gt;
The platform sends out events when a couple of events are performed. Code can be written to bind to these.&lt;br /&gt;
&lt;br /&gt;
===Events=== &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;hide-field&amp;lt;/code&amp;gt;, triggered when the platform hides a field (dependency or hideField-function)&lt;br /&gt;
*&amp;lt;code&amp;gt;show-field&amp;lt;/code&amp;gt;, triggered when the platform shows a field (dependency or showField-function)&lt;br /&gt;
&lt;br /&gt;
===How to bind ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;tr&amp;quot;).bind(&amp;quot;hide-field&amp;quot;, function(e) {&lt;br /&gt;
    // Do stuff..&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Value dependencies==&lt;br /&gt;
Using lookup select boxes you can set up complex dependencies between values. The target field will be filtered when the page loads and on all changes to the filter field(s).&lt;br /&gt;
&lt;br /&gt;
===Single dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterOnChange(fieldNameTarget, fieldNameSource, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [ TargetValue, SourceValue ... ],&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTER&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; and &amp;quot;Dong&amp;quot; will be available to select when  FILTER = &amp;quot;Foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Double dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterDoubleOnChange(fieldNameTarget, fieldNameSource1, fieldNameSource2, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Dog&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Fish&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterDoubleOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTERA&amp;quot;, &amp;quot;FILTERB&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; will be available to select when either : &lt;br /&gt;
*FILTERA = &amp;quot;Foo&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
*FILTERA = &amp;quot;Bar&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Value triggers==&lt;br /&gt;
Value triggers will make things happen when a field changes. Multiple triggers can be assigned to the same field.&lt;br /&gt;
&lt;br /&gt;
*'''setValueOnChange(sourceName,targetName,targetValue)'''&lt;br /&gt;
* '''setValueOnSetValue(sourceName,sourceValue,targetName,targetValue)'''&lt;br /&gt;
&lt;br /&gt;
Sets the value if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
setValueOnChange(&amp;quot;CATEGORY&amp;quot;,&amp;quot;Silver&amp;quot;,&amp;quot;StatusID&amp;quot;,&amp;quot;Customer changed&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''warningOnChange(sourceName,message)'''&lt;br /&gt;
*'''warningOnSetValue(sourceName,sourceValue,message)'''&lt;br /&gt;
&lt;br /&gt;
Display a warning to a user if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Value lookups==&lt;br /&gt;
Value lookups will copy values from other records to the current one. The normal usecase is records referring other records via parent references.&lt;br /&gt;
&lt;br /&gt;
*'''getValueFromLookup(SourceSagID,SourceDataID,FieldNameSource)'''&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookup(SourceSagID,SourceDataID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will &lt;br /&gt;
#Make a call to ?SagID=''[SagID]''&amp;amp;DataID=''[DataID]''&amp;amp;command=show&lt;br /&gt;
#Pickup the value in the page at #VB_DATA_''[FieldNameSource]''&lt;br /&gt;
#Insert the value in the local field ''FieldNameTarget''&lt;br /&gt;
&lt;br /&gt;
The DataID on the remote record can be picked up automatically by specifying FieldNameTrigger. Note this will only work as long as the trigger field is in editable and the value is changed.&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookupTriggered(FieldNameTrigger,SourceSagID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will  &lt;br /&gt;
#E´xtract the DataID form the field ''FieldNameTrigger''&lt;br /&gt;
# Same as above&lt;br /&gt;
&lt;br /&gt;
== Named queries ==&lt;br /&gt;
You can add peprared statements configurations and make paramterized class to them&lt;br /&gt;
&lt;br /&gt;
*'''lookupNamedQuery(query,value)'''&lt;br /&gt;
&lt;br /&gt;
The query executed in the backend, must be stored under the configuration named: &amp;quot;NamedQueryLookup.&amp;quot; + query&lt;br /&gt;
&lt;br /&gt;
The value will be inserted into the ? parameter an escaped properly&lt;br /&gt;
&lt;br /&gt;
  SELECT CVR FROM data_company WHERE NAME = ?&lt;br /&gt;
&lt;br /&gt;
If call is made from an entity the Query will be stored in either&lt;br /&gt;
* Entity configuration (if SagID on caller page is present in URL)&lt;br /&gt;
* System configuration&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
In the following example we want to look up a phone number from an email value in the entity 'company'.&lt;br /&gt;
&lt;br /&gt;
==== Client code ====&lt;br /&gt;
Somewhere in a Javascript the following code is found&lt;br /&gt;
&lt;br /&gt;
  var email = getValue(&amp;quot;EMAIL&amp;quot;);&lt;br /&gt;
  setValue( &amp;quot;PHONE&amp;quot;,&lt;br /&gt;
     '''lookupNamedQuery(&amp;quot;FindPhoneFromEmail&amp;quot;,email)'''&lt;br /&gt;
  )&lt;br /&gt;
&lt;br /&gt;
==== Server code ====&lt;br /&gt;
In the configuration '''NamedQueryLookup.FindPhoneFromEmail''' the following SQL is stored&lt;br /&gt;
&lt;br /&gt;
   SELECT COMPANYPHONE FROM data_company WHERE COMPANYEMAIL = ?&lt;br /&gt;
&lt;br /&gt;
==Inspect command and users==&lt;br /&gt;
The currect command can be examined using&lt;br /&gt;
*'''isCommandNew()'''&lt;br /&gt;
*'''isCommandEdit()'''&lt;br /&gt;
*'''isCommandList()'''&lt;br /&gt;
&lt;br /&gt;
Note that commands are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User types can be determined using&lt;br /&gt;
&lt;br /&gt;
* '''isUserAdmin()'''&lt;br /&gt;
*'''isUserExternal()'''&lt;br /&gt;
*'''isUserNormal()'''&lt;br /&gt;
* '''isUserExclusive()''' (from version 6248)&lt;br /&gt;
&lt;br /&gt;
Note that special roles are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage IsAdministrator listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows for custom CSS for special roles&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   .IsAdministrator h1 { color: red; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Other functions==&lt;br /&gt;
&lt;br /&gt;
=== selectSingleOption(fieldName) ===&lt;br /&gt;
Will set a value if only one option is avaiable in a select box.&lt;br /&gt;
&lt;br /&gt;
=== warnDateAfterOtherDate( dateA, dateZ, message ) ===&lt;br /&gt;
Alerts the user via a popup, if two dates are not after each other. Both date changes triggers the test.&lt;br /&gt;
&lt;br /&gt;
=== disableErrorCountInTitle() and enableErrorCountInTitle() (6734+) ===&lt;br /&gt;
Will disable/enable displaying of numbers of errors i the page-title. Default is enabled&lt;br /&gt;
&lt;br /&gt;
=== changeFieldToShow(fieldName) ===&lt;br /&gt;
Remove input and select boxes and replace them with the value in the field&lt;br /&gt;
&lt;br /&gt;
=== showMoreTableRows(fieldName,rowsShown,buttonLabel) ===&lt;br /&gt;
Makes a nested table shorter by hiding lines &amp;gt; rowsShown. Hidden rows can be shown with the button below the table.&lt;br /&gt;
&lt;br /&gt;
=Control variables=&lt;br /&gt;
TS uses a number of special variables to control the behavior of the frontend. These variables can be changed anywhere.&lt;br /&gt;
&lt;br /&gt;
===Opening new windows===&lt;br /&gt;
Window default sizes are controlled by the following variables&lt;br /&gt;
*'''tsOpenWindowHeight''' = 680;&lt;br /&gt;
*'''tsOpenWindowWidth'''  = 820;&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===Dependency hiding fields ===&lt;br /&gt;
'''hideTableRowsForElements''' is by default true. &lt;br /&gt;
&lt;br /&gt;
Set to false if template structure is only in a single level.&lt;br /&gt;
*true: Hide two parent nodes when hiding fields&lt;br /&gt;
*false: Hide single parent node when hiding fields&lt;br /&gt;
&lt;br /&gt;
Example of 2 level template (default)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example of 1 level template (special cases)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
  &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
=Other sources=&lt;br /&gt;
&lt;br /&gt;
*[[JQUERY / SCRIPT CHEATSHEET| Readonly radiobuttons, copy text in field, build selectbox from service ...]]&lt;br /&gt;
*[[HACKING DEPENDENT VALUES| Handling dependent lookup values (showing all elements etc.)]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7283</id>
		<title>JavaScript functions v1.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7283"/>
		<updated>2025-06-11T13:58:36Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Client code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;amp;nbsp;&lt;br /&gt;
= Code placement =&lt;br /&gt;
The following places can contain JS code&lt;br /&gt;
* Entity header&lt;br /&gt;
* Entity status&lt;br /&gt;
* JavaScript field&lt;br /&gt;
&lt;br /&gt;
Additionally HTML with inline script can be placed in&lt;br /&gt;
* Wrapper&lt;br /&gt;
* Template&lt;br /&gt;
&lt;br /&gt;
Finally expressions can be evaluated using&lt;br /&gt;
* Entity field dependency&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
= Builtin functions =&lt;br /&gt;
The following functions are only available for single item views (edit or show).&lt;br /&gt;
&lt;br /&gt;
== Get and set values ==&lt;br /&gt;
Display values are handled using standard getter and setters&lt;br /&gt;
* '''getValue(fieldName) '''&lt;br /&gt;
* '''setValue(fieldName,value) '''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let a = getValue(&amp;quot;NUMBER1&amp;quot;);&lt;br /&gt;
let b = getValue(&amp;quot;NUMBER2&amp;quot;);&lt;br /&gt;
setValue( &amp;quot;RESULT&amp;quot;, (a-b) );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For explicitly getting a value (or ID) use&lt;br /&gt;
* '''getDecimal(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let recordId = getDecimal(&amp;quot;SELECTRECORD&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Toggling fields (5478+) ==&lt;br /&gt;
Note: Hide functions are NOT intended for denying access to data -it will only be hidden in the frontend, but is still accessible to savvy users.&lt;br /&gt;
&lt;br /&gt;
Fields can be  shown or hidden calling the fieldname&lt;br /&gt;
* '''hideField(fieldName)'''&lt;br /&gt;
* '''showField(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;USER&amp;quot;);&lt;br /&gt;
hideField(&amp;quot;StatusID&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Dependent toggling ===&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage&lt;br /&gt;
* '''hideFieldForPageClass(fieldName,className)'''&lt;br /&gt;
* '''showFieldForPageClass(fieldName,className)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on items current status.&lt;br /&gt;
* '''hideFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
* '''showFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage AND items current status.&lt;br /&gt;
* '''hideFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
*'''showFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
&lt;br /&gt;
In case of advanced setup consider &amp;quot;hide for all first and show for some later&amp;quot;.&lt;br /&gt;
In this example NAME should only be displayed for a few status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;NAME&amp;quot;);   &lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1234);&lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1235);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Disclaimer ===&lt;br /&gt;
The functions are the equivilant of JQuery &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that fields are expected to be wrapped in TWO layers of html tags for the functions to work&lt;br /&gt;
&lt;br /&gt;
== Toggling status ==&lt;br /&gt;
A convenience method is planned for version 7800. Untill then you can use a Jquery expression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(&amp;quot;#DATA_StatusID option[value='123']&amp;quot;).remove();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Binding to events (6734+)==&lt;br /&gt;
The platform sends out events when a couple of events are performed. Code can be written to bind to these.&lt;br /&gt;
&lt;br /&gt;
===Events=== &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;hide-field&amp;lt;/code&amp;gt;, triggered when the platform hides a field (dependency or hideField-function)&lt;br /&gt;
*&amp;lt;code&amp;gt;show-field&amp;lt;/code&amp;gt;, triggered when the platform shows a field (dependency or showField-function)&lt;br /&gt;
&lt;br /&gt;
===How to bind ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;tr&amp;quot;).bind(&amp;quot;hide-field&amp;quot;, function(e) {&lt;br /&gt;
    // Do stuff..&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Value dependencies==&lt;br /&gt;
Using lookup select boxes you can set up complex dependencies between values. The target field will be filtered when the page loads and on all changes to the filter field(s).&lt;br /&gt;
&lt;br /&gt;
===Single dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterOnChange(fieldNameTarget, fieldNameSource, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [ TargetValue, SourceValue ... ],&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTER&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; and &amp;quot;Dong&amp;quot; will be available to select when  FILTER = &amp;quot;Foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Double dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterDoubleOnChange(fieldNameTarget, fieldNameSource1, fieldNameSource2, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Dog&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Fish&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterDoubleOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTERA&amp;quot;, &amp;quot;FILTERB&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; will be available to select when either : &lt;br /&gt;
*FILTERA = &amp;quot;Foo&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
*FILTERA = &amp;quot;Bar&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Value triggers==&lt;br /&gt;
Value triggers will make things happen when a field changes. Multiple triggers can be assigned to the same field.&lt;br /&gt;
&lt;br /&gt;
*'''setValueOnChange(sourceName,targetName,targetValue)'''&lt;br /&gt;
* '''setValueOnSetValue(sourceName,sourceValue,targetName,targetValue)'''&lt;br /&gt;
&lt;br /&gt;
Sets the value if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
setValueOnChange(&amp;quot;CATEGORY&amp;quot;,&amp;quot;Silver&amp;quot;,&amp;quot;StatusID&amp;quot;,&amp;quot;Customer changed&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''warningOnChange(sourceName,message)'''&lt;br /&gt;
*'''warningOnSetValue(sourceName,sourceValue,message)'''&lt;br /&gt;
&lt;br /&gt;
Display a warning to a user if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Value lookups==&lt;br /&gt;
Value lookups will copy values from other records to the current one. The normal usecase is records referring other records via parent references.&lt;br /&gt;
&lt;br /&gt;
*'''getValueFromLookup(SourceSagID,SourceDataID,FieldNameSource)'''&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookup(SourceSagID,SourceDataID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will &lt;br /&gt;
#Make a call to ?SagID=''[SagID]''&amp;amp;DataID=''[DataID]''&amp;amp;command=show&lt;br /&gt;
#Pickup the value in the page at #VB_DATA_''[FieldNameSource]''&lt;br /&gt;
#Insert the value in the local field ''FieldNameTarget''&lt;br /&gt;
&lt;br /&gt;
The DataID on the remote record can be picked up automatically by specifying FieldNameTrigger. Note this will only work as long as the trigger field is in editable and the value is changed.&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookupTriggered(FieldNameTrigger,SourceSagID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will  &lt;br /&gt;
#E´xtract the DataID form the field ''FieldNameTrigger''&lt;br /&gt;
# Same as above&lt;br /&gt;
&lt;br /&gt;
== Named queries ==&lt;br /&gt;
You can add peprared statements configurations and make paramterized class to them&lt;br /&gt;
&lt;br /&gt;
*'''lookupNamedQuery(query,value)'''&lt;br /&gt;
&lt;br /&gt;
The query executed in the backend, must be stored under the configuration named: &amp;quot;NamedQueryLookup.&amp;quot; + query&lt;br /&gt;
&lt;br /&gt;
The value will be inserted into the ? parameter an escaped properly&lt;br /&gt;
&lt;br /&gt;
  SELECT CVR FROM data_company WHERE NAME = ?&lt;br /&gt;
&lt;br /&gt;
If call is made from an entity the Query will be stored in either&lt;br /&gt;
* Entity configuration (if SagID on caller page is present in URL)&lt;br /&gt;
* System configuration&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
In the following example we want to look up a phone number from an email value in the entity 'company'.&lt;br /&gt;
&lt;br /&gt;
==== Client code ====&lt;br /&gt;
Somewhere in a Javascript the following code is found&lt;br /&gt;
&lt;br /&gt;
  var email = getValue(&amp;quot;EMAIL&amp;quot;);&lt;br /&gt;
  setValue( &amp;quot;PHONE&amp;quot;,&lt;br /&gt;
     '''lookupNamedQuery(&amp;quot;FindPhoneFromEmail&amp;quot;,email)'''&lt;br /&gt;
  )&lt;br /&gt;
&lt;br /&gt;
==== Server code ====&lt;br /&gt;
In the configuration 'NamedQueryLookup.FindPhoneFromEmail' the following SQL is stored&lt;br /&gt;
&lt;br /&gt;
   SELECT COMPANYPHONE FROM data_company WHERE COMPANYEMAIL = ?&lt;br /&gt;
&lt;br /&gt;
==Inspect command and users==&lt;br /&gt;
The currect command can be examined using&lt;br /&gt;
*'''isCommandNew()'''&lt;br /&gt;
*'''isCommandEdit()'''&lt;br /&gt;
*'''isCommandList()'''&lt;br /&gt;
&lt;br /&gt;
Note that commands are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User types can be determined using&lt;br /&gt;
&lt;br /&gt;
* '''isUserAdmin()'''&lt;br /&gt;
*'''isUserExternal()'''&lt;br /&gt;
*'''isUserNormal()'''&lt;br /&gt;
* '''isUserExclusive()''' (from version 6248)&lt;br /&gt;
&lt;br /&gt;
Note that special roles are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage IsAdministrator listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows for custom CSS for special roles&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   .IsAdministrator h1 { color: red; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Other functions==&lt;br /&gt;
&lt;br /&gt;
=== selectSingleOption(fieldName) ===&lt;br /&gt;
Will set a value if only one option is avaiable in a select box.&lt;br /&gt;
&lt;br /&gt;
=== warnDateAfterOtherDate( dateA, dateZ, message ) ===&lt;br /&gt;
Alerts the user via a popup, if two dates are not after each other. Both date changes triggers the test.&lt;br /&gt;
&lt;br /&gt;
=== disableErrorCountInTitle() and enableErrorCountInTitle() (6734+) ===&lt;br /&gt;
Will disable/enable displaying of numbers of errors i the page-title. Default is enabled&lt;br /&gt;
&lt;br /&gt;
=== changeFieldToShow(fieldName) ===&lt;br /&gt;
Remove input and select boxes and replace them with the value in the field&lt;br /&gt;
&lt;br /&gt;
=== showMoreTableRows(fieldName,rowsShown,buttonLabel) ===&lt;br /&gt;
Makes a nested table shorter by hiding lines &amp;gt; rowsShown. Hidden rows can be shown with the button below the table.&lt;br /&gt;
&lt;br /&gt;
=Control variables=&lt;br /&gt;
TS uses a number of special variables to control the behavior of the frontend. These variables can be changed anywhere.&lt;br /&gt;
&lt;br /&gt;
===Opening new windows===&lt;br /&gt;
Window default sizes are controlled by the following variables&lt;br /&gt;
*'''tsOpenWindowHeight''' = 680;&lt;br /&gt;
*'''tsOpenWindowWidth'''  = 820;&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===Dependency hiding fields ===&lt;br /&gt;
'''hideTableRowsForElements''' is by default true. &lt;br /&gt;
&lt;br /&gt;
Set to false if template structure is only in a single level.&lt;br /&gt;
*true: Hide two parent nodes when hiding fields&lt;br /&gt;
*false: Hide single parent node when hiding fields&lt;br /&gt;
&lt;br /&gt;
Example of 2 level template (default)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example of 1 level template (special cases)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
  &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
=Other sources=&lt;br /&gt;
&lt;br /&gt;
*[[JQUERY / SCRIPT CHEATSHEET| Readonly radiobuttons, copy text in field, build selectbox from service ...]]&lt;br /&gt;
*[[HACKING DEPENDENT VALUES| Handling dependent lookup values (showing all elements etc.)]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7282</id>
		<title>JavaScript functions v1.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7282"/>
		<updated>2025-06-11T13:58:09Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Named queries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;amp;nbsp;&lt;br /&gt;
= Code placement =&lt;br /&gt;
The following places can contain JS code&lt;br /&gt;
* Entity header&lt;br /&gt;
* Entity status&lt;br /&gt;
* JavaScript field&lt;br /&gt;
&lt;br /&gt;
Additionally HTML with inline script can be placed in&lt;br /&gt;
* Wrapper&lt;br /&gt;
* Template&lt;br /&gt;
&lt;br /&gt;
Finally expressions can be evaluated using&lt;br /&gt;
* Entity field dependency&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
= Builtin functions =&lt;br /&gt;
The following functions are only available for single item views (edit or show).&lt;br /&gt;
&lt;br /&gt;
== Get and set values ==&lt;br /&gt;
Display values are handled using standard getter and setters&lt;br /&gt;
* '''getValue(fieldName) '''&lt;br /&gt;
* '''setValue(fieldName,value) '''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let a = getValue(&amp;quot;NUMBER1&amp;quot;);&lt;br /&gt;
let b = getValue(&amp;quot;NUMBER2&amp;quot;);&lt;br /&gt;
setValue( &amp;quot;RESULT&amp;quot;, (a-b) );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For explicitly getting a value (or ID) use&lt;br /&gt;
* '''getDecimal(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let recordId = getDecimal(&amp;quot;SELECTRECORD&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Toggling fields (5478+) ==&lt;br /&gt;
Note: Hide functions are NOT intended for denying access to data -it will only be hidden in the frontend, but is still accessible to savvy users.&lt;br /&gt;
&lt;br /&gt;
Fields can be  shown or hidden calling the fieldname&lt;br /&gt;
* '''hideField(fieldName)'''&lt;br /&gt;
* '''showField(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;USER&amp;quot;);&lt;br /&gt;
hideField(&amp;quot;StatusID&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Dependent toggling ===&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage&lt;br /&gt;
* '''hideFieldForPageClass(fieldName,className)'''&lt;br /&gt;
* '''showFieldForPageClass(fieldName,className)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on items current status.&lt;br /&gt;
* '''hideFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
* '''showFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage AND items current status.&lt;br /&gt;
* '''hideFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
*'''showFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
&lt;br /&gt;
In case of advanced setup consider &amp;quot;hide for all first and show for some later&amp;quot;.&lt;br /&gt;
In this example NAME should only be displayed for a few status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;NAME&amp;quot;);   &lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1234);&lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1235);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Disclaimer ===&lt;br /&gt;
The functions are the equivilant of JQuery &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that fields are expected to be wrapped in TWO layers of html tags for the functions to work&lt;br /&gt;
&lt;br /&gt;
== Toggling status ==&lt;br /&gt;
A convenience method is planned for version 7800. Untill then you can use a Jquery expression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(&amp;quot;#DATA_StatusID option[value='123']&amp;quot;).remove();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Binding to events (6734+)==&lt;br /&gt;
The platform sends out events when a couple of events are performed. Code can be written to bind to these.&lt;br /&gt;
&lt;br /&gt;
===Events=== &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;hide-field&amp;lt;/code&amp;gt;, triggered when the platform hides a field (dependency or hideField-function)&lt;br /&gt;
*&amp;lt;code&amp;gt;show-field&amp;lt;/code&amp;gt;, triggered when the platform shows a field (dependency or showField-function)&lt;br /&gt;
&lt;br /&gt;
===How to bind ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;tr&amp;quot;).bind(&amp;quot;hide-field&amp;quot;, function(e) {&lt;br /&gt;
    // Do stuff..&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Value dependencies==&lt;br /&gt;
Using lookup select boxes you can set up complex dependencies between values. The target field will be filtered when the page loads and on all changes to the filter field(s).&lt;br /&gt;
&lt;br /&gt;
===Single dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterOnChange(fieldNameTarget, fieldNameSource, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [ TargetValue, SourceValue ... ],&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTER&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; and &amp;quot;Dong&amp;quot; will be available to select when  FILTER = &amp;quot;Foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Double dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterDoubleOnChange(fieldNameTarget, fieldNameSource1, fieldNameSource2, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Dog&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Fish&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterDoubleOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTERA&amp;quot;, &amp;quot;FILTERB&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; will be available to select when either : &lt;br /&gt;
*FILTERA = &amp;quot;Foo&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
*FILTERA = &amp;quot;Bar&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Value triggers==&lt;br /&gt;
Value triggers will make things happen when a field changes. Multiple triggers can be assigned to the same field.&lt;br /&gt;
&lt;br /&gt;
*'''setValueOnChange(sourceName,targetName,targetValue)'''&lt;br /&gt;
* '''setValueOnSetValue(sourceName,sourceValue,targetName,targetValue)'''&lt;br /&gt;
&lt;br /&gt;
Sets the value if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
setValueOnChange(&amp;quot;CATEGORY&amp;quot;,&amp;quot;Silver&amp;quot;,&amp;quot;StatusID&amp;quot;,&amp;quot;Customer changed&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''warningOnChange(sourceName,message)'''&lt;br /&gt;
*'''warningOnSetValue(sourceName,sourceValue,message)'''&lt;br /&gt;
&lt;br /&gt;
Display a warning to a user if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Value lookups==&lt;br /&gt;
Value lookups will copy values from other records to the current one. The normal usecase is records referring other records via parent references.&lt;br /&gt;
&lt;br /&gt;
*'''getValueFromLookup(SourceSagID,SourceDataID,FieldNameSource)'''&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookup(SourceSagID,SourceDataID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will &lt;br /&gt;
#Make a call to ?SagID=''[SagID]''&amp;amp;DataID=''[DataID]''&amp;amp;command=show&lt;br /&gt;
#Pickup the value in the page at #VB_DATA_''[FieldNameSource]''&lt;br /&gt;
#Insert the value in the local field ''FieldNameTarget''&lt;br /&gt;
&lt;br /&gt;
The DataID on the remote record can be picked up automatically by specifying FieldNameTrigger. Note this will only work as long as the trigger field is in editable and the value is changed.&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookupTriggered(FieldNameTrigger,SourceSagID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will  &lt;br /&gt;
#E´xtract the DataID form the field ''FieldNameTrigger''&lt;br /&gt;
# Same as above&lt;br /&gt;
&lt;br /&gt;
== Named queries ==&lt;br /&gt;
You can add peprared statements configurations and make paramterized class to them&lt;br /&gt;
&lt;br /&gt;
*'''lookupNamedQuery(query,value)'''&lt;br /&gt;
&lt;br /&gt;
The query executed in the backend, must be stored under the configuration named: &amp;quot;NamedQueryLookup.&amp;quot; + query&lt;br /&gt;
&lt;br /&gt;
The value will be inserted into the ? parameter an escaped properly&lt;br /&gt;
&lt;br /&gt;
  SELECT CVR FROM data_company WHERE NAME = ?&lt;br /&gt;
&lt;br /&gt;
If call is made from an entity the Query will be stored in either&lt;br /&gt;
* Entity configuration (if SagID on caller page is present in URL)&lt;br /&gt;
* System configuration&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
In the following example we want to look up a phone number from an email value in the entity 'company'.&lt;br /&gt;
&lt;br /&gt;
==== Client code ====&lt;br /&gt;
Somewhere in a Javascript the following code is found&lt;br /&gt;
&lt;br /&gt;
  var email = getValue(&amp;quot;EMAIL&amp;quot;);&lt;br /&gt;
  setValue( &amp;quot;PHONE&amp;quot;,&lt;br /&gt;
     lookupNamedQuery(&amp;quot;FindPhoneFromEmail&amp;quot;,email) &lt;br /&gt;
  ) &lt;br /&gt;
&lt;br /&gt;
==== Server code ====&lt;br /&gt;
In the configuration 'NamedQueryLookup.FindPhoneFromEmail' the following SQL is stored&lt;br /&gt;
&lt;br /&gt;
   SELECT COMPANYPHONE FROM data_company WHERE COMPANYEMAIL = ?&lt;br /&gt;
&lt;br /&gt;
==Inspect command and users==&lt;br /&gt;
The currect command can be examined using&lt;br /&gt;
*'''isCommandNew()'''&lt;br /&gt;
*'''isCommandEdit()'''&lt;br /&gt;
*'''isCommandList()'''&lt;br /&gt;
&lt;br /&gt;
Note that commands are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User types can be determined using&lt;br /&gt;
&lt;br /&gt;
* '''isUserAdmin()'''&lt;br /&gt;
*'''isUserExternal()'''&lt;br /&gt;
*'''isUserNormal()'''&lt;br /&gt;
* '''isUserExclusive()''' (from version 6248)&lt;br /&gt;
&lt;br /&gt;
Note that special roles are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage IsAdministrator listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows for custom CSS for special roles&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   .IsAdministrator h1 { color: red; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Other functions==&lt;br /&gt;
&lt;br /&gt;
=== selectSingleOption(fieldName) ===&lt;br /&gt;
Will set a value if only one option is avaiable in a select box.&lt;br /&gt;
&lt;br /&gt;
=== warnDateAfterOtherDate( dateA, dateZ, message ) ===&lt;br /&gt;
Alerts the user via a popup, if two dates are not after each other. Both date changes triggers the test.&lt;br /&gt;
&lt;br /&gt;
=== disableErrorCountInTitle() and enableErrorCountInTitle() (6734+) ===&lt;br /&gt;
Will disable/enable displaying of numbers of errors i the page-title. Default is enabled&lt;br /&gt;
&lt;br /&gt;
=== changeFieldToShow(fieldName) ===&lt;br /&gt;
Remove input and select boxes and replace them with the value in the field&lt;br /&gt;
&lt;br /&gt;
=== showMoreTableRows(fieldName,rowsShown,buttonLabel) ===&lt;br /&gt;
Makes a nested table shorter by hiding lines &amp;gt; rowsShown. Hidden rows can be shown with the button below the table.&lt;br /&gt;
&lt;br /&gt;
=Control variables=&lt;br /&gt;
TS uses a number of special variables to control the behavior of the frontend. These variables can be changed anywhere.&lt;br /&gt;
&lt;br /&gt;
===Opening new windows===&lt;br /&gt;
Window default sizes are controlled by the following variables&lt;br /&gt;
*'''tsOpenWindowHeight''' = 680;&lt;br /&gt;
*'''tsOpenWindowWidth'''  = 820;&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===Dependency hiding fields ===&lt;br /&gt;
'''hideTableRowsForElements''' is by default true. &lt;br /&gt;
&lt;br /&gt;
Set to false if template structure is only in a single level.&lt;br /&gt;
*true: Hide two parent nodes when hiding fields&lt;br /&gt;
*false: Hide single parent node when hiding fields&lt;br /&gt;
&lt;br /&gt;
Example of 2 level template (default)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example of 1 level template (special cases)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
  &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
=Other sources=&lt;br /&gt;
&lt;br /&gt;
*[[JQUERY / SCRIPT CHEATSHEET| Readonly radiobuttons, copy text in field, build selectbox from service ...]]&lt;br /&gt;
*[[HACKING DEPENDENT VALUES| Handling dependent lookup values (showing all elements etc.)]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7281</id>
		<title>JavaScript functions v1.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7281"/>
		<updated>2025-06-11T13:52:33Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Named queries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;amp;nbsp;&lt;br /&gt;
= Code placement =&lt;br /&gt;
The following places can contain JS code&lt;br /&gt;
* Entity header&lt;br /&gt;
* Entity status&lt;br /&gt;
* JavaScript field&lt;br /&gt;
&lt;br /&gt;
Additionally HTML with inline script can be placed in&lt;br /&gt;
* Wrapper&lt;br /&gt;
* Template&lt;br /&gt;
&lt;br /&gt;
Finally expressions can be evaluated using&lt;br /&gt;
* Entity field dependency&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
= Builtin functions =&lt;br /&gt;
The following functions are only available for single item views (edit or show).&lt;br /&gt;
&lt;br /&gt;
== Get and set values ==&lt;br /&gt;
Display values are handled using standard getter and setters&lt;br /&gt;
* '''getValue(fieldName) '''&lt;br /&gt;
* '''setValue(fieldName,value) '''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let a = getValue(&amp;quot;NUMBER1&amp;quot;);&lt;br /&gt;
let b = getValue(&amp;quot;NUMBER2&amp;quot;);&lt;br /&gt;
setValue( &amp;quot;RESULT&amp;quot;, (a-b) );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For explicitly getting a value (or ID) use&lt;br /&gt;
* '''getDecimal(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let recordId = getDecimal(&amp;quot;SELECTRECORD&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Toggling fields (5478+) ==&lt;br /&gt;
Note: Hide functions are NOT intended for denying access to data -it will only be hidden in the frontend, but is still accessible to savvy users.&lt;br /&gt;
&lt;br /&gt;
Fields can be  shown or hidden calling the fieldname&lt;br /&gt;
* '''hideField(fieldName)'''&lt;br /&gt;
* '''showField(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;USER&amp;quot;);&lt;br /&gt;
hideField(&amp;quot;StatusID&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Dependent toggling ===&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage&lt;br /&gt;
* '''hideFieldForPageClass(fieldName,className)'''&lt;br /&gt;
* '''showFieldForPageClass(fieldName,className)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on items current status.&lt;br /&gt;
* '''hideFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
* '''showFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage AND items current status.&lt;br /&gt;
* '''hideFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
*'''showFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
&lt;br /&gt;
In case of advanced setup consider &amp;quot;hide for all first and show for some later&amp;quot;.&lt;br /&gt;
In this example NAME should only be displayed for a few status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;NAME&amp;quot;);   &lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1234);&lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1235);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Disclaimer ===&lt;br /&gt;
The functions are the equivilant of JQuery &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that fields are expected to be wrapped in TWO layers of html tags for the functions to work&lt;br /&gt;
&lt;br /&gt;
== Toggling status ==&lt;br /&gt;
A convenience method is planned for version 7800. Untill then you can use a Jquery expression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(&amp;quot;#DATA_StatusID option[value='123']&amp;quot;).remove();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Binding to events (6734+)==&lt;br /&gt;
The platform sends out events when a couple of events are performed. Code can be written to bind to these.&lt;br /&gt;
&lt;br /&gt;
===Events=== &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;hide-field&amp;lt;/code&amp;gt;, triggered when the platform hides a field (dependency or hideField-function)&lt;br /&gt;
*&amp;lt;code&amp;gt;show-field&amp;lt;/code&amp;gt;, triggered when the platform shows a field (dependency or showField-function)&lt;br /&gt;
&lt;br /&gt;
===How to bind ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;tr&amp;quot;).bind(&amp;quot;hide-field&amp;quot;, function(e) {&lt;br /&gt;
    // Do stuff..&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Value dependencies==&lt;br /&gt;
Using lookup select boxes you can set up complex dependencies between values. The target field will be filtered when the page loads and on all changes to the filter field(s).&lt;br /&gt;
&lt;br /&gt;
===Single dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterOnChange(fieldNameTarget, fieldNameSource, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [ TargetValue, SourceValue ... ],&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTER&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; and &amp;quot;Dong&amp;quot; will be available to select when  FILTER = &amp;quot;Foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Double dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterDoubleOnChange(fieldNameTarget, fieldNameSource1, fieldNameSource2, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Dog&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Fish&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterDoubleOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTERA&amp;quot;, &amp;quot;FILTERB&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; will be available to select when either : &lt;br /&gt;
*FILTERA = &amp;quot;Foo&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
*FILTERA = &amp;quot;Bar&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Value triggers==&lt;br /&gt;
Value triggers will make things happen when a field changes. Multiple triggers can be assigned to the same field.&lt;br /&gt;
&lt;br /&gt;
*'''setValueOnChange(sourceName,targetName,targetValue)'''&lt;br /&gt;
* '''setValueOnSetValue(sourceName,sourceValue,targetName,targetValue)'''&lt;br /&gt;
&lt;br /&gt;
Sets the value if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
setValueOnChange(&amp;quot;CATEGORY&amp;quot;,&amp;quot;Silver&amp;quot;,&amp;quot;StatusID&amp;quot;,&amp;quot;Customer changed&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''warningOnChange(sourceName,message)'''&lt;br /&gt;
*'''warningOnSetValue(sourceName,sourceValue,message)'''&lt;br /&gt;
&lt;br /&gt;
Display a warning to a user if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Value lookups==&lt;br /&gt;
Value lookups will copy values from other records to the current one. The normal usecase is records referring other records via parent references.&lt;br /&gt;
&lt;br /&gt;
*'''getValueFromLookup(SourceSagID,SourceDataID,FieldNameSource)'''&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookup(SourceSagID,SourceDataID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will &lt;br /&gt;
#Make a call to ?SagID=''[SagID]''&amp;amp;DataID=''[DataID]''&amp;amp;command=show&lt;br /&gt;
#Pickup the value in the page at #VB_DATA_''[FieldNameSource]''&lt;br /&gt;
#Insert the value in the local field ''FieldNameTarget''&lt;br /&gt;
&lt;br /&gt;
The DataID on the remote record can be picked up automatically by specifying FieldNameTrigger. Note this will only work as long as the trigger field is in editable and the value is changed.&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookupTriggered(FieldNameTrigger,SourceSagID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will  &lt;br /&gt;
#E´xtract the DataID form the field ''FieldNameTrigger''&lt;br /&gt;
# Same as above&lt;br /&gt;
&lt;br /&gt;
== Named queries ==&lt;br /&gt;
You can add peprared statements configurations and make paramterized class to them&lt;br /&gt;
&lt;br /&gt;
*'''lookupNamedQuery(query,value)'''&lt;br /&gt;
&lt;br /&gt;
Example code (client)&lt;br /&gt;
&lt;br /&gt;
  var email = getValue(&amp;quot;EMAIL&amp;quot;);&lt;br /&gt;
  setValue( &amp;quot;PHONE&amp;quot;,&lt;br /&gt;
     lookupNamedQuery(&amp;quot;FindPhoneFromEmail&amp;quot;,email) &lt;br /&gt;
  ) &lt;br /&gt;
&lt;br /&gt;
The query executed in the backend, must be stored under the configuration named: &amp;quot;NamedQueryLookup&amp;quot; + query&lt;br /&gt;
&lt;br /&gt;
The value will be inserted into the ? parameter an escaped properly&lt;br /&gt;
&lt;br /&gt;
  SELECT CVR FROM data_company WHERE NAME = ?&lt;br /&gt;
&lt;br /&gt;
If call is made from an entity the Query will be stored in either&lt;br /&gt;
* Entity configuration (if SagID on caller page is present in URL)&lt;br /&gt;
* System configuration&lt;br /&gt;
&lt;br /&gt;
==Inspect command and users==&lt;br /&gt;
The currect command can be examined using&lt;br /&gt;
*'''isCommandNew()'''&lt;br /&gt;
*'''isCommandEdit()'''&lt;br /&gt;
*'''isCommandList()'''&lt;br /&gt;
&lt;br /&gt;
Note that commands are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User types can be determined using&lt;br /&gt;
&lt;br /&gt;
* '''isUserAdmin()'''&lt;br /&gt;
*'''isUserExternal()'''&lt;br /&gt;
*'''isUserNormal()'''&lt;br /&gt;
* '''isUserExclusive()''' (from version 6248)&lt;br /&gt;
&lt;br /&gt;
Note that special roles are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage IsAdministrator listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows for custom CSS for special roles&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   .IsAdministrator h1 { color: red; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Other functions==&lt;br /&gt;
&lt;br /&gt;
=== selectSingleOption(fieldName) ===&lt;br /&gt;
Will set a value if only one option is avaiable in a select box.&lt;br /&gt;
&lt;br /&gt;
=== warnDateAfterOtherDate( dateA, dateZ, message ) ===&lt;br /&gt;
Alerts the user via a popup, if two dates are not after each other. Both date changes triggers the test.&lt;br /&gt;
&lt;br /&gt;
=== disableErrorCountInTitle() and enableErrorCountInTitle() (6734+) ===&lt;br /&gt;
Will disable/enable displaying of numbers of errors i the page-title. Default is enabled&lt;br /&gt;
&lt;br /&gt;
=== changeFieldToShow(fieldName) ===&lt;br /&gt;
Remove input and select boxes and replace them with the value in the field&lt;br /&gt;
&lt;br /&gt;
=== showMoreTableRows(fieldName,rowsShown,buttonLabel) ===&lt;br /&gt;
Makes a nested table shorter by hiding lines &amp;gt; rowsShown. Hidden rows can be shown with the button below the table.&lt;br /&gt;
&lt;br /&gt;
=Control variables=&lt;br /&gt;
TS uses a number of special variables to control the behavior of the frontend. These variables can be changed anywhere.&lt;br /&gt;
&lt;br /&gt;
===Opening new windows===&lt;br /&gt;
Window default sizes are controlled by the following variables&lt;br /&gt;
*'''tsOpenWindowHeight''' = 680;&lt;br /&gt;
*'''tsOpenWindowWidth'''  = 820;&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===Dependency hiding fields ===&lt;br /&gt;
'''hideTableRowsForElements''' is by default true. &lt;br /&gt;
&lt;br /&gt;
Set to false if template structure is only in a single level.&lt;br /&gt;
*true: Hide two parent nodes when hiding fields&lt;br /&gt;
*false: Hide single parent node when hiding fields&lt;br /&gt;
&lt;br /&gt;
Example of 2 level template (default)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example of 1 level template (special cases)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
  &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
=Other sources=&lt;br /&gt;
&lt;br /&gt;
*[[JQUERY / SCRIPT CHEATSHEET| Readonly radiobuttons, copy text in field, build selectbox from service ...]]&lt;br /&gt;
*[[HACKING DEPENDENT VALUES| Handling dependent lookup values (showing all elements etc.)]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7280</id>
		<title>JavaScript functions v1.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7280"/>
		<updated>2025-06-11T13:52:01Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Named queries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;amp;nbsp;&lt;br /&gt;
= Code placement =&lt;br /&gt;
The following places can contain JS code&lt;br /&gt;
* Entity header&lt;br /&gt;
* Entity status&lt;br /&gt;
* JavaScript field&lt;br /&gt;
&lt;br /&gt;
Additionally HTML with inline script can be placed in&lt;br /&gt;
* Wrapper&lt;br /&gt;
* Template&lt;br /&gt;
&lt;br /&gt;
Finally expressions can be evaluated using&lt;br /&gt;
* Entity field dependency&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
= Builtin functions =&lt;br /&gt;
The following functions are only available for single item views (edit or show).&lt;br /&gt;
&lt;br /&gt;
== Get and set values ==&lt;br /&gt;
Display values are handled using standard getter and setters&lt;br /&gt;
* '''getValue(fieldName) '''&lt;br /&gt;
* '''setValue(fieldName,value) '''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let a = getValue(&amp;quot;NUMBER1&amp;quot;);&lt;br /&gt;
let b = getValue(&amp;quot;NUMBER2&amp;quot;);&lt;br /&gt;
setValue( &amp;quot;RESULT&amp;quot;, (a-b) );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For explicitly getting a value (or ID) use&lt;br /&gt;
* '''getDecimal(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let recordId = getDecimal(&amp;quot;SELECTRECORD&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Toggling fields (5478+) ==&lt;br /&gt;
Note: Hide functions are NOT intended for denying access to data -it will only be hidden in the frontend, but is still accessible to savvy users.&lt;br /&gt;
&lt;br /&gt;
Fields can be  shown or hidden calling the fieldname&lt;br /&gt;
* '''hideField(fieldName)'''&lt;br /&gt;
* '''showField(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;USER&amp;quot;);&lt;br /&gt;
hideField(&amp;quot;StatusID&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Dependent toggling ===&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage&lt;br /&gt;
* '''hideFieldForPageClass(fieldName,className)'''&lt;br /&gt;
* '''showFieldForPageClass(fieldName,className)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on items current status.&lt;br /&gt;
* '''hideFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
* '''showFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage AND items current status.&lt;br /&gt;
* '''hideFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
*'''showFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
&lt;br /&gt;
In case of advanced setup consider &amp;quot;hide for all first and show for some later&amp;quot;.&lt;br /&gt;
In this example NAME should only be displayed for a few status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;NAME&amp;quot;);   &lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1234);&lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1235);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Disclaimer ===&lt;br /&gt;
The functions are the equivilant of JQuery &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that fields are expected to be wrapped in TWO layers of html tags for the functions to work&lt;br /&gt;
&lt;br /&gt;
== Toggling status ==&lt;br /&gt;
A convenience method is planned for version 7800. Untill then you can use a Jquery expression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(&amp;quot;#DATA_StatusID option[value='123']&amp;quot;).remove();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Binding to events (6734+)==&lt;br /&gt;
The platform sends out events when a couple of events are performed. Code can be written to bind to these.&lt;br /&gt;
&lt;br /&gt;
===Events=== &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;hide-field&amp;lt;/code&amp;gt;, triggered when the platform hides a field (dependency or hideField-function)&lt;br /&gt;
*&amp;lt;code&amp;gt;show-field&amp;lt;/code&amp;gt;, triggered when the platform shows a field (dependency or showField-function)&lt;br /&gt;
&lt;br /&gt;
===How to bind ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;tr&amp;quot;).bind(&amp;quot;hide-field&amp;quot;, function(e) {&lt;br /&gt;
    // Do stuff..&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Value dependencies==&lt;br /&gt;
Using lookup select boxes you can set up complex dependencies between values. The target field will be filtered when the page loads and on all changes to the filter field(s).&lt;br /&gt;
&lt;br /&gt;
===Single dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterOnChange(fieldNameTarget, fieldNameSource, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [ TargetValue, SourceValue ... ],&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTER&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; and &amp;quot;Dong&amp;quot; will be available to select when  FILTER = &amp;quot;Foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Double dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterDoubleOnChange(fieldNameTarget, fieldNameSource1, fieldNameSource2, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Dog&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Fish&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterDoubleOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTERA&amp;quot;, &amp;quot;FILTERB&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; will be available to select when either : &lt;br /&gt;
*FILTERA = &amp;quot;Foo&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
*FILTERA = &amp;quot;Bar&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Value triggers==&lt;br /&gt;
Value triggers will make things happen when a field changes. Multiple triggers can be assigned to the same field.&lt;br /&gt;
&lt;br /&gt;
*'''setValueOnChange(sourceName,targetName,targetValue)'''&lt;br /&gt;
* '''setValueOnSetValue(sourceName,sourceValue,targetName,targetValue)'''&lt;br /&gt;
&lt;br /&gt;
Sets the value if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
setValueOnChange(&amp;quot;CATEGORY&amp;quot;,&amp;quot;Silver&amp;quot;,&amp;quot;StatusID&amp;quot;,&amp;quot;Customer changed&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''warningOnChange(sourceName,message)'''&lt;br /&gt;
*'''warningOnSetValue(sourceName,sourceValue,message)'''&lt;br /&gt;
&lt;br /&gt;
Display a warning to a user if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Value lookups==&lt;br /&gt;
Value lookups will copy values from other records to the current one. The normal usecase is records referring other records via parent references.&lt;br /&gt;
&lt;br /&gt;
*'''getValueFromLookup(SourceSagID,SourceDataID,FieldNameSource)'''&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookup(SourceSagID,SourceDataID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will &lt;br /&gt;
#Make a call to ?SagID=''[SagID]''&amp;amp;DataID=''[DataID]''&amp;amp;command=show&lt;br /&gt;
#Pickup the value in the page at #VB_DATA_''[FieldNameSource]''&lt;br /&gt;
#Insert the value in the local field ''FieldNameTarget''&lt;br /&gt;
&lt;br /&gt;
The DataID on the remote record can be picked up automatically by specifying FieldNameTrigger. Note this will only work as long as the trigger field is in editable and the value is changed.&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookupTriggered(FieldNameTrigger,SourceSagID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will  &lt;br /&gt;
#E´xtract the DataID form the field ''FieldNameTrigger''&lt;br /&gt;
# Same as above&lt;br /&gt;
&lt;br /&gt;
== Named queries ==&lt;br /&gt;
You can add peprared statements configurations and make paramterized class to them&lt;br /&gt;
&lt;br /&gt;
*'''lookupNamedQuery(query,value)'''&lt;br /&gt;
&lt;br /&gt;
JS example code &lt;br /&gt;
&lt;br /&gt;
  var email = getValue(&amp;quot;EMAIL&amp;quot;);&lt;br /&gt;
  setValue( &amp;quot;PHONE&amp;quot;,&lt;br /&gt;
     lookupNamedQuery(&amp;quot;FindPhoneFromEmail&amp;quot;,email) &lt;br /&gt;
  ) &lt;br /&gt;
&lt;br /&gt;
The query executed in the backend, must be stored under the configuration named: &amp;quot;NamedQueryLookup&amp;quot; + query&lt;br /&gt;
&lt;br /&gt;
The value will be inserted into the ? parameter an escaped properly&lt;br /&gt;
&lt;br /&gt;
  SELECT CVR FROM data_company WHERE NAME = ?&lt;br /&gt;
&lt;br /&gt;
If call is made from an entity the Query will be stored in either&lt;br /&gt;
* Entity configuration (if SagID on caller page is present in URL)&lt;br /&gt;
* System configuration&lt;br /&gt;
&lt;br /&gt;
==Inspect command and users==&lt;br /&gt;
The currect command can be examined using&lt;br /&gt;
*'''isCommandNew()'''&lt;br /&gt;
*'''isCommandEdit()'''&lt;br /&gt;
*'''isCommandList()'''&lt;br /&gt;
&lt;br /&gt;
Note that commands are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User types can be determined using&lt;br /&gt;
&lt;br /&gt;
* '''isUserAdmin()'''&lt;br /&gt;
*'''isUserExternal()'''&lt;br /&gt;
*'''isUserNormal()'''&lt;br /&gt;
* '''isUserExclusive()''' (from version 6248)&lt;br /&gt;
&lt;br /&gt;
Note that special roles are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage IsAdministrator listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows for custom CSS for special roles&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   .IsAdministrator h1 { color: red; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Other functions==&lt;br /&gt;
&lt;br /&gt;
=== selectSingleOption(fieldName) ===&lt;br /&gt;
Will set a value if only one option is avaiable in a select box.&lt;br /&gt;
&lt;br /&gt;
=== warnDateAfterOtherDate( dateA, dateZ, message ) ===&lt;br /&gt;
Alerts the user via a popup, if two dates are not after each other. Both date changes triggers the test.&lt;br /&gt;
&lt;br /&gt;
=== disableErrorCountInTitle() and enableErrorCountInTitle() (6734+) ===&lt;br /&gt;
Will disable/enable displaying of numbers of errors i the page-title. Default is enabled&lt;br /&gt;
&lt;br /&gt;
=== changeFieldToShow(fieldName) ===&lt;br /&gt;
Remove input and select boxes and replace them with the value in the field&lt;br /&gt;
&lt;br /&gt;
=== showMoreTableRows(fieldName,rowsShown,buttonLabel) ===&lt;br /&gt;
Makes a nested table shorter by hiding lines &amp;gt; rowsShown. Hidden rows can be shown with the button below the table.&lt;br /&gt;
&lt;br /&gt;
=Control variables=&lt;br /&gt;
TS uses a number of special variables to control the behavior of the frontend. These variables can be changed anywhere.&lt;br /&gt;
&lt;br /&gt;
===Opening new windows===&lt;br /&gt;
Window default sizes are controlled by the following variables&lt;br /&gt;
*'''tsOpenWindowHeight''' = 680;&lt;br /&gt;
*'''tsOpenWindowWidth'''  = 820;&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===Dependency hiding fields ===&lt;br /&gt;
'''hideTableRowsForElements''' is by default true. &lt;br /&gt;
&lt;br /&gt;
Set to false if template structure is only in a single level.&lt;br /&gt;
*true: Hide two parent nodes when hiding fields&lt;br /&gt;
*false: Hide single parent node when hiding fields&lt;br /&gt;
&lt;br /&gt;
Example of 2 level template (default)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example of 1 level template (special cases)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
  &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
=Other sources=&lt;br /&gt;
&lt;br /&gt;
*[[JQUERY / SCRIPT CHEATSHEET| Readonly radiobuttons, copy text in field, build selectbox from service ...]]&lt;br /&gt;
*[[HACKING DEPENDENT VALUES| Handling dependent lookup values (showing all elements etc.)]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7279</id>
		<title>JavaScript functions v1.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7279"/>
		<updated>2025-06-11T13:49:51Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Named queries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;amp;nbsp;&lt;br /&gt;
= Code placement =&lt;br /&gt;
The following places can contain JS code&lt;br /&gt;
* Entity header&lt;br /&gt;
* Entity status&lt;br /&gt;
* JavaScript field&lt;br /&gt;
&lt;br /&gt;
Additionally HTML with inline script can be placed in&lt;br /&gt;
* Wrapper&lt;br /&gt;
* Template&lt;br /&gt;
&lt;br /&gt;
Finally expressions can be evaluated using&lt;br /&gt;
* Entity field dependency&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
= Builtin functions =&lt;br /&gt;
The following functions are only available for single item views (edit or show).&lt;br /&gt;
&lt;br /&gt;
== Get and set values ==&lt;br /&gt;
Display values are handled using standard getter and setters&lt;br /&gt;
* '''getValue(fieldName) '''&lt;br /&gt;
* '''setValue(fieldName,value) '''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let a = getValue(&amp;quot;NUMBER1&amp;quot;);&lt;br /&gt;
let b = getValue(&amp;quot;NUMBER2&amp;quot;);&lt;br /&gt;
setValue( &amp;quot;RESULT&amp;quot;, (a-b) );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For explicitly getting a value (or ID) use&lt;br /&gt;
* '''getDecimal(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let recordId = getDecimal(&amp;quot;SELECTRECORD&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Toggling fields (5478+) ==&lt;br /&gt;
Note: Hide functions are NOT intended for denying access to data -it will only be hidden in the frontend, but is still accessible to savvy users.&lt;br /&gt;
&lt;br /&gt;
Fields can be  shown or hidden calling the fieldname&lt;br /&gt;
* '''hideField(fieldName)'''&lt;br /&gt;
* '''showField(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;USER&amp;quot;);&lt;br /&gt;
hideField(&amp;quot;StatusID&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Dependent toggling ===&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage&lt;br /&gt;
* '''hideFieldForPageClass(fieldName,className)'''&lt;br /&gt;
* '''showFieldForPageClass(fieldName,className)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on items current status.&lt;br /&gt;
* '''hideFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
* '''showFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage AND items current status.&lt;br /&gt;
* '''hideFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
*'''showFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
&lt;br /&gt;
In case of advanced setup consider &amp;quot;hide for all first and show for some later&amp;quot;.&lt;br /&gt;
In this example NAME should only be displayed for a few status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;NAME&amp;quot;);   &lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1234);&lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1235);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Disclaimer ===&lt;br /&gt;
The functions are the equivilant of JQuery &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that fields are expected to be wrapped in TWO layers of html tags for the functions to work&lt;br /&gt;
&lt;br /&gt;
== Toggling status ==&lt;br /&gt;
A convenience method is planned for version 7800. Untill then you can use a Jquery expression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(&amp;quot;#DATA_StatusID option[value='123']&amp;quot;).remove();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Binding to events (6734+)==&lt;br /&gt;
The platform sends out events when a couple of events are performed. Code can be written to bind to these.&lt;br /&gt;
&lt;br /&gt;
===Events=== &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;hide-field&amp;lt;/code&amp;gt;, triggered when the platform hides a field (dependency or hideField-function)&lt;br /&gt;
*&amp;lt;code&amp;gt;show-field&amp;lt;/code&amp;gt;, triggered when the platform shows a field (dependency or showField-function)&lt;br /&gt;
&lt;br /&gt;
===How to bind ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;tr&amp;quot;).bind(&amp;quot;hide-field&amp;quot;, function(e) {&lt;br /&gt;
    // Do stuff..&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Value dependencies==&lt;br /&gt;
Using lookup select boxes you can set up complex dependencies between values. The target field will be filtered when the page loads and on all changes to the filter field(s).&lt;br /&gt;
&lt;br /&gt;
===Single dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterOnChange(fieldNameTarget, fieldNameSource, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [ TargetValue, SourceValue ... ],&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTER&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; and &amp;quot;Dong&amp;quot; will be available to select when  FILTER = &amp;quot;Foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Double dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterDoubleOnChange(fieldNameTarget, fieldNameSource1, fieldNameSource2, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Dog&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Fish&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterDoubleOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTERA&amp;quot;, &amp;quot;FILTERB&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; will be available to select when either : &lt;br /&gt;
*FILTERA = &amp;quot;Foo&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
*FILTERA = &amp;quot;Bar&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Value triggers==&lt;br /&gt;
Value triggers will make things happen when a field changes. Multiple triggers can be assigned to the same field.&lt;br /&gt;
&lt;br /&gt;
*'''setValueOnChange(sourceName,targetName,targetValue)'''&lt;br /&gt;
* '''setValueOnSetValue(sourceName,sourceValue,targetName,targetValue)'''&lt;br /&gt;
&lt;br /&gt;
Sets the value if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
setValueOnChange(&amp;quot;CATEGORY&amp;quot;,&amp;quot;Silver&amp;quot;,&amp;quot;StatusID&amp;quot;,&amp;quot;Customer changed&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''warningOnChange(sourceName,message)'''&lt;br /&gt;
*'''warningOnSetValue(sourceName,sourceValue,message)'''&lt;br /&gt;
&lt;br /&gt;
Display a warning to a user if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Value lookups==&lt;br /&gt;
Value lookups will copy values from other records to the current one. The normal usecase is records referring other records via parent references.&lt;br /&gt;
&lt;br /&gt;
*'''getValueFromLookup(SourceSagID,SourceDataID,FieldNameSource)'''&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookup(SourceSagID,SourceDataID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will &lt;br /&gt;
#Make a call to ?SagID=''[SagID]''&amp;amp;DataID=''[DataID]''&amp;amp;command=show&lt;br /&gt;
#Pickup the value in the page at #VB_DATA_''[FieldNameSource]''&lt;br /&gt;
#Insert the value in the local field ''FieldNameTarget''&lt;br /&gt;
&lt;br /&gt;
The DataID on the remote record can be picked up automatically by specifying FieldNameTrigger. Note this will only work as long as the trigger field is in editable and the value is changed.&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookupTriggered(FieldNameTrigger,SourceSagID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will  &lt;br /&gt;
#E´xtract the DataID form the field ''FieldNameTrigger''&lt;br /&gt;
# Same as above&lt;br /&gt;
&lt;br /&gt;
== Named queries ==&lt;br /&gt;
You can add peprared statements configurations and make paramterized class to them&lt;br /&gt;
&lt;br /&gt;
*'''lookupNamedQuery(query,value)'''&lt;br /&gt;
&lt;br /&gt;
The query executed in the backend, must be stored under the configuration named: &amp;quot;NamedQueryLookup&amp;quot; + query&lt;br /&gt;
&lt;br /&gt;
The value will be inserted into the ? parameter an escaped properly&lt;br /&gt;
&lt;br /&gt;
  SELECT CVR FROM data_company WHERE NAME = ?&lt;br /&gt;
&lt;br /&gt;
If call is made from an entity the Query will be stored in either&lt;br /&gt;
* Entity configuration (if SagID on caller page is present in URL)&lt;br /&gt;
* System configuration&lt;br /&gt;
&lt;br /&gt;
==Inspect command and users==&lt;br /&gt;
The currect command can be examined using&lt;br /&gt;
*'''isCommandNew()'''&lt;br /&gt;
*'''isCommandEdit()'''&lt;br /&gt;
*'''isCommandList()'''&lt;br /&gt;
&lt;br /&gt;
Note that commands are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User types can be determined using&lt;br /&gt;
&lt;br /&gt;
* '''isUserAdmin()'''&lt;br /&gt;
*'''isUserExternal()'''&lt;br /&gt;
*'''isUserNormal()'''&lt;br /&gt;
* '''isUserExclusive()''' (from version 6248)&lt;br /&gt;
&lt;br /&gt;
Note that special roles are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage IsAdministrator listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows for custom CSS for special roles&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   .IsAdministrator h1 { color: red; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Other functions==&lt;br /&gt;
&lt;br /&gt;
=== selectSingleOption(fieldName) ===&lt;br /&gt;
Will set a value if only one option is avaiable in a select box.&lt;br /&gt;
&lt;br /&gt;
=== warnDateAfterOtherDate( dateA, dateZ, message ) ===&lt;br /&gt;
Alerts the user via a popup, if two dates are not after each other. Both date changes triggers the test.&lt;br /&gt;
&lt;br /&gt;
=== disableErrorCountInTitle() and enableErrorCountInTitle() (6734+) ===&lt;br /&gt;
Will disable/enable displaying of numbers of errors i the page-title. Default is enabled&lt;br /&gt;
&lt;br /&gt;
=== changeFieldToShow(fieldName) ===&lt;br /&gt;
Remove input and select boxes and replace them with the value in the field&lt;br /&gt;
&lt;br /&gt;
=== showMoreTableRows(fieldName,rowsShown,buttonLabel) ===&lt;br /&gt;
Makes a nested table shorter by hiding lines &amp;gt; rowsShown. Hidden rows can be shown with the button below the table.&lt;br /&gt;
&lt;br /&gt;
=Control variables=&lt;br /&gt;
TS uses a number of special variables to control the behavior of the frontend. These variables can be changed anywhere.&lt;br /&gt;
&lt;br /&gt;
===Opening new windows===&lt;br /&gt;
Window default sizes are controlled by the following variables&lt;br /&gt;
*'''tsOpenWindowHeight''' = 680;&lt;br /&gt;
*'''tsOpenWindowWidth'''  = 820;&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===Dependency hiding fields ===&lt;br /&gt;
'''hideTableRowsForElements''' is by default true. &lt;br /&gt;
&lt;br /&gt;
Set to false if template structure is only in a single level.&lt;br /&gt;
*true: Hide two parent nodes when hiding fields&lt;br /&gt;
*false: Hide single parent node when hiding fields&lt;br /&gt;
&lt;br /&gt;
Example of 2 level template (default)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example of 1 level template (special cases)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
  &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
=Other sources=&lt;br /&gt;
&lt;br /&gt;
*[[JQUERY / SCRIPT CHEATSHEET| Readonly radiobuttons, copy text in field, build selectbox from service ...]]&lt;br /&gt;
*[[HACKING DEPENDENT VALUES| Handling dependent lookup values (showing all elements etc.)]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7278</id>
		<title>JavaScript functions v1.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7278"/>
		<updated>2025-06-11T13:49:20Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Named queries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;amp;nbsp;&lt;br /&gt;
= Code placement =&lt;br /&gt;
The following places can contain JS code&lt;br /&gt;
* Entity header&lt;br /&gt;
* Entity status&lt;br /&gt;
* JavaScript field&lt;br /&gt;
&lt;br /&gt;
Additionally HTML with inline script can be placed in&lt;br /&gt;
* Wrapper&lt;br /&gt;
* Template&lt;br /&gt;
&lt;br /&gt;
Finally expressions can be evaluated using&lt;br /&gt;
* Entity field dependency&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
= Builtin functions =&lt;br /&gt;
The following functions are only available for single item views (edit or show).&lt;br /&gt;
&lt;br /&gt;
== Get and set values ==&lt;br /&gt;
Display values are handled using standard getter and setters&lt;br /&gt;
* '''getValue(fieldName) '''&lt;br /&gt;
* '''setValue(fieldName,value) '''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let a = getValue(&amp;quot;NUMBER1&amp;quot;);&lt;br /&gt;
let b = getValue(&amp;quot;NUMBER2&amp;quot;);&lt;br /&gt;
setValue( &amp;quot;RESULT&amp;quot;, (a-b) );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For explicitly getting a value (or ID) use&lt;br /&gt;
* '''getDecimal(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let recordId = getDecimal(&amp;quot;SELECTRECORD&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Toggling fields (5478+) ==&lt;br /&gt;
Note: Hide functions are NOT intended for denying access to data -it will only be hidden in the frontend, but is still accessible to savvy users.&lt;br /&gt;
&lt;br /&gt;
Fields can be  shown or hidden calling the fieldname&lt;br /&gt;
* '''hideField(fieldName)'''&lt;br /&gt;
* '''showField(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;USER&amp;quot;);&lt;br /&gt;
hideField(&amp;quot;StatusID&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Dependent toggling ===&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage&lt;br /&gt;
* '''hideFieldForPageClass(fieldName,className)'''&lt;br /&gt;
* '''showFieldForPageClass(fieldName,className)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on items current status.&lt;br /&gt;
* '''hideFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
* '''showFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage AND items current status.&lt;br /&gt;
* '''hideFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
*'''showFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
&lt;br /&gt;
In case of advanced setup consider &amp;quot;hide for all first and show for some later&amp;quot;.&lt;br /&gt;
In this example NAME should only be displayed for a few status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;NAME&amp;quot;);   &lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1234);&lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1235);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Disclaimer ===&lt;br /&gt;
The functions are the equivilant of JQuery &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that fields are expected to be wrapped in TWO layers of html tags for the functions to work&lt;br /&gt;
&lt;br /&gt;
== Toggling status ==&lt;br /&gt;
A convenience method is planned for version 7800. Untill then you can use a Jquery expression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(&amp;quot;#DATA_StatusID option[value='123']&amp;quot;).remove();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Binding to events (6734+)==&lt;br /&gt;
The platform sends out events when a couple of events are performed. Code can be written to bind to these.&lt;br /&gt;
&lt;br /&gt;
===Events=== &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;hide-field&amp;lt;/code&amp;gt;, triggered when the platform hides a field (dependency or hideField-function)&lt;br /&gt;
*&amp;lt;code&amp;gt;show-field&amp;lt;/code&amp;gt;, triggered when the platform shows a field (dependency or showField-function)&lt;br /&gt;
&lt;br /&gt;
===How to bind ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;tr&amp;quot;).bind(&amp;quot;hide-field&amp;quot;, function(e) {&lt;br /&gt;
    // Do stuff..&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Value dependencies==&lt;br /&gt;
Using lookup select boxes you can set up complex dependencies between values. The target field will be filtered when the page loads and on all changes to the filter field(s).&lt;br /&gt;
&lt;br /&gt;
===Single dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterOnChange(fieldNameTarget, fieldNameSource, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [ TargetValue, SourceValue ... ],&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTER&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; and &amp;quot;Dong&amp;quot; will be available to select when  FILTER = &amp;quot;Foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Double dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterDoubleOnChange(fieldNameTarget, fieldNameSource1, fieldNameSource2, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Dog&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Fish&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterDoubleOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTERA&amp;quot;, &amp;quot;FILTERB&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; will be available to select when either : &lt;br /&gt;
*FILTERA = &amp;quot;Foo&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
*FILTERA = &amp;quot;Bar&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Value triggers==&lt;br /&gt;
Value triggers will make things happen when a field changes. Multiple triggers can be assigned to the same field.&lt;br /&gt;
&lt;br /&gt;
*'''setValueOnChange(sourceName,targetName,targetValue)'''&lt;br /&gt;
* '''setValueOnSetValue(sourceName,sourceValue,targetName,targetValue)'''&lt;br /&gt;
&lt;br /&gt;
Sets the value if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
setValueOnChange(&amp;quot;CATEGORY&amp;quot;,&amp;quot;Silver&amp;quot;,&amp;quot;StatusID&amp;quot;,&amp;quot;Customer changed&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''warningOnChange(sourceName,message)'''&lt;br /&gt;
*'''warningOnSetValue(sourceName,sourceValue,message)'''&lt;br /&gt;
&lt;br /&gt;
Display a warning to a user if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Value lookups==&lt;br /&gt;
Value lookups will copy values from other records to the current one. The normal usecase is records referring other records via parent references.&lt;br /&gt;
&lt;br /&gt;
*'''getValueFromLookup(SourceSagID,SourceDataID,FieldNameSource)'''&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookup(SourceSagID,SourceDataID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will &lt;br /&gt;
#Make a call to ?SagID=''[SagID]''&amp;amp;DataID=''[DataID]''&amp;amp;command=show&lt;br /&gt;
#Pickup the value in the page at #VB_DATA_''[FieldNameSource]''&lt;br /&gt;
#Insert the value in the local field ''FieldNameTarget''&lt;br /&gt;
&lt;br /&gt;
The DataID on the remote record can be picked up automatically by specifying FieldNameTrigger. Note this will only work as long as the trigger field is in editable and the value is changed.&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookupTriggered(FieldNameTrigger,SourceSagID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will  &lt;br /&gt;
#E´xtract the DataID form the field ''FieldNameTrigger''&lt;br /&gt;
# Same as above&lt;br /&gt;
&lt;br /&gt;
== Named queries ==&lt;br /&gt;
You can add peprared statements configurations and make paramterized class to them&lt;br /&gt;
&lt;br /&gt;
*'''lookupNamedQuery(query,value)'''&lt;br /&gt;
&lt;br /&gt;
The query executed in the backend, must be stored under the configuration named: &amp;quot;NamedQueryLookup&amp;quot; + query&lt;br /&gt;
&lt;br /&gt;
The value will be inserted into the ? parameter an escaped properly&lt;br /&gt;
&lt;br /&gt;
  SELECT CVR FROM data_company WHERE NAME = ?&lt;br /&gt;
&lt;br /&gt;
If call is made from an entity the Query will be stored in either&lt;br /&gt;
* Entity configuration (if SagID on caller page is present)&lt;br /&gt;
* System configuration&lt;br /&gt;
&lt;br /&gt;
==Inspect command and users==&lt;br /&gt;
The currect command can be examined using&lt;br /&gt;
*'''isCommandNew()'''&lt;br /&gt;
*'''isCommandEdit()'''&lt;br /&gt;
*'''isCommandList()'''&lt;br /&gt;
&lt;br /&gt;
Note that commands are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User types can be determined using&lt;br /&gt;
&lt;br /&gt;
* '''isUserAdmin()'''&lt;br /&gt;
*'''isUserExternal()'''&lt;br /&gt;
*'''isUserNormal()'''&lt;br /&gt;
* '''isUserExclusive()''' (from version 6248)&lt;br /&gt;
&lt;br /&gt;
Note that special roles are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage IsAdministrator listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows for custom CSS for special roles&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   .IsAdministrator h1 { color: red; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Other functions==&lt;br /&gt;
&lt;br /&gt;
=== selectSingleOption(fieldName) ===&lt;br /&gt;
Will set a value if only one option is avaiable in a select box.&lt;br /&gt;
&lt;br /&gt;
=== warnDateAfterOtherDate( dateA, dateZ, message ) ===&lt;br /&gt;
Alerts the user via a popup, if two dates are not after each other. Both date changes triggers the test.&lt;br /&gt;
&lt;br /&gt;
=== disableErrorCountInTitle() and enableErrorCountInTitle() (6734+) ===&lt;br /&gt;
Will disable/enable displaying of numbers of errors i the page-title. Default is enabled&lt;br /&gt;
&lt;br /&gt;
=== changeFieldToShow(fieldName) ===&lt;br /&gt;
Remove input and select boxes and replace them with the value in the field&lt;br /&gt;
&lt;br /&gt;
=== showMoreTableRows(fieldName,rowsShown,buttonLabel) ===&lt;br /&gt;
Makes a nested table shorter by hiding lines &amp;gt; rowsShown. Hidden rows can be shown with the button below the table.&lt;br /&gt;
&lt;br /&gt;
=Control variables=&lt;br /&gt;
TS uses a number of special variables to control the behavior of the frontend. These variables can be changed anywhere.&lt;br /&gt;
&lt;br /&gt;
===Opening new windows===&lt;br /&gt;
Window default sizes are controlled by the following variables&lt;br /&gt;
*'''tsOpenWindowHeight''' = 680;&lt;br /&gt;
*'''tsOpenWindowWidth'''  = 820;&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===Dependency hiding fields ===&lt;br /&gt;
'''hideTableRowsForElements''' is by default true. &lt;br /&gt;
&lt;br /&gt;
Set to false if template structure is only in a single level.&lt;br /&gt;
*true: Hide two parent nodes when hiding fields&lt;br /&gt;
*false: Hide single parent node when hiding fields&lt;br /&gt;
&lt;br /&gt;
Example of 2 level template (default)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example of 1 level template (special cases)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
  &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
=Other sources=&lt;br /&gt;
&lt;br /&gt;
*[[JQUERY / SCRIPT CHEATSHEET| Readonly radiobuttons, copy text in field, build selectbox from service ...]]&lt;br /&gt;
*[[HACKING DEPENDENT VALUES| Handling dependent lookup values (showing all elements etc.)]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7277</id>
		<title>JavaScript functions v1.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7277"/>
		<updated>2025-06-11T13:47:14Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Named queries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;amp;nbsp;&lt;br /&gt;
= Code placement =&lt;br /&gt;
The following places can contain JS code&lt;br /&gt;
* Entity header&lt;br /&gt;
* Entity status&lt;br /&gt;
* JavaScript field&lt;br /&gt;
&lt;br /&gt;
Additionally HTML with inline script can be placed in&lt;br /&gt;
* Wrapper&lt;br /&gt;
* Template&lt;br /&gt;
&lt;br /&gt;
Finally expressions can be evaluated using&lt;br /&gt;
* Entity field dependency&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
= Builtin functions =&lt;br /&gt;
The following functions are only available for single item views (edit or show).&lt;br /&gt;
&lt;br /&gt;
== Get and set values ==&lt;br /&gt;
Display values are handled using standard getter and setters&lt;br /&gt;
* '''getValue(fieldName) '''&lt;br /&gt;
* '''setValue(fieldName,value) '''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let a = getValue(&amp;quot;NUMBER1&amp;quot;);&lt;br /&gt;
let b = getValue(&amp;quot;NUMBER2&amp;quot;);&lt;br /&gt;
setValue( &amp;quot;RESULT&amp;quot;, (a-b) );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For explicitly getting a value (or ID) use&lt;br /&gt;
* '''getDecimal(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let recordId = getDecimal(&amp;quot;SELECTRECORD&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Toggling fields (5478+) ==&lt;br /&gt;
Note: Hide functions are NOT intended for denying access to data -it will only be hidden in the frontend, but is still accessible to savvy users.&lt;br /&gt;
&lt;br /&gt;
Fields can be  shown or hidden calling the fieldname&lt;br /&gt;
* '''hideField(fieldName)'''&lt;br /&gt;
* '''showField(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;USER&amp;quot;);&lt;br /&gt;
hideField(&amp;quot;StatusID&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Dependent toggling ===&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage&lt;br /&gt;
* '''hideFieldForPageClass(fieldName,className)'''&lt;br /&gt;
* '''showFieldForPageClass(fieldName,className)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on items current status.&lt;br /&gt;
* '''hideFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
* '''showFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage AND items current status.&lt;br /&gt;
* '''hideFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
*'''showFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
&lt;br /&gt;
In case of advanced setup consider &amp;quot;hide for all first and show for some later&amp;quot;.&lt;br /&gt;
In this example NAME should only be displayed for a few status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;NAME&amp;quot;);   &lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1234);&lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1235);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Disclaimer ===&lt;br /&gt;
The functions are the equivilant of JQuery &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that fields are expected to be wrapped in TWO layers of html tags for the functions to work&lt;br /&gt;
&lt;br /&gt;
== Toggling status ==&lt;br /&gt;
A convenience method is planned for version 7800. Untill then you can use a Jquery expression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(&amp;quot;#DATA_StatusID option[value='123']&amp;quot;).remove();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Binding to events (6734+)==&lt;br /&gt;
The platform sends out events when a couple of events are performed. Code can be written to bind to these.&lt;br /&gt;
&lt;br /&gt;
===Events=== &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;hide-field&amp;lt;/code&amp;gt;, triggered when the platform hides a field (dependency or hideField-function)&lt;br /&gt;
*&amp;lt;code&amp;gt;show-field&amp;lt;/code&amp;gt;, triggered when the platform shows a field (dependency or showField-function)&lt;br /&gt;
&lt;br /&gt;
===How to bind ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;tr&amp;quot;).bind(&amp;quot;hide-field&amp;quot;, function(e) {&lt;br /&gt;
    // Do stuff..&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Value dependencies==&lt;br /&gt;
Using lookup select boxes you can set up complex dependencies between values. The target field will be filtered when the page loads and on all changes to the filter field(s).&lt;br /&gt;
&lt;br /&gt;
===Single dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterOnChange(fieldNameTarget, fieldNameSource, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [ TargetValue, SourceValue ... ],&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTER&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; and &amp;quot;Dong&amp;quot; will be available to select when  FILTER = &amp;quot;Foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Double dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterDoubleOnChange(fieldNameTarget, fieldNameSource1, fieldNameSource2, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Dog&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Fish&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterDoubleOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTERA&amp;quot;, &amp;quot;FILTERB&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; will be available to select when either : &lt;br /&gt;
*FILTERA = &amp;quot;Foo&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
*FILTERA = &amp;quot;Bar&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Value triggers==&lt;br /&gt;
Value triggers will make things happen when a field changes. Multiple triggers can be assigned to the same field.&lt;br /&gt;
&lt;br /&gt;
*'''setValueOnChange(sourceName,targetName,targetValue)'''&lt;br /&gt;
* '''setValueOnSetValue(sourceName,sourceValue,targetName,targetValue)'''&lt;br /&gt;
&lt;br /&gt;
Sets the value if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
setValueOnChange(&amp;quot;CATEGORY&amp;quot;,&amp;quot;Silver&amp;quot;,&amp;quot;StatusID&amp;quot;,&amp;quot;Customer changed&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''warningOnChange(sourceName,message)'''&lt;br /&gt;
*'''warningOnSetValue(sourceName,sourceValue,message)'''&lt;br /&gt;
&lt;br /&gt;
Display a warning to a user if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Value lookups==&lt;br /&gt;
Value lookups will copy values from other records to the current one. The normal usecase is records referring other records via parent references.&lt;br /&gt;
&lt;br /&gt;
*'''getValueFromLookup(SourceSagID,SourceDataID,FieldNameSource)'''&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookup(SourceSagID,SourceDataID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will &lt;br /&gt;
#Make a call to ?SagID=''[SagID]''&amp;amp;DataID=''[DataID]''&amp;amp;command=show&lt;br /&gt;
#Pickup the value in the page at #VB_DATA_''[FieldNameSource]''&lt;br /&gt;
#Insert the value in the local field ''FieldNameTarget''&lt;br /&gt;
&lt;br /&gt;
The DataID on the remote record can be picked up automatically by specifying FieldNameTrigger. Note this will only work as long as the trigger field is in editable and the value is changed.&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookupTriggered(FieldNameTrigger,SourceSagID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will  &lt;br /&gt;
#E´xtract the DataID form the field ''FieldNameTrigger''&lt;br /&gt;
# Same as above&lt;br /&gt;
&lt;br /&gt;
== Named queries ==&lt;br /&gt;
You can add peprared statements configurations and make paramterized class to them&lt;br /&gt;
&lt;br /&gt;
*'''lookupNamedQuery(query,value)'''&lt;br /&gt;
&lt;br /&gt;
The query executed in the backend, must be stored under the configuration named: &amp;quot;NamedQueryLookup&amp;quot; + query&lt;br /&gt;
&lt;br /&gt;
The value will be inserted into the ? parameter an escaped properly&lt;br /&gt;
&lt;br /&gt;
  SELECT CVR FROM data_company WHERE NAME = ?&lt;br /&gt;
&lt;br /&gt;
If call is made from an entity the Query will be stored in either&lt;br /&gt;
* Entity configuration&lt;br /&gt;
* System configuration&lt;br /&gt;
&lt;br /&gt;
==Inspect command and users==&lt;br /&gt;
The currect command can be examined using&lt;br /&gt;
*'''isCommandNew()'''&lt;br /&gt;
*'''isCommandEdit()'''&lt;br /&gt;
*'''isCommandList()'''&lt;br /&gt;
&lt;br /&gt;
Note that commands are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User types can be determined using&lt;br /&gt;
&lt;br /&gt;
* '''isUserAdmin()'''&lt;br /&gt;
*'''isUserExternal()'''&lt;br /&gt;
*'''isUserNormal()'''&lt;br /&gt;
* '''isUserExclusive()''' (from version 6248)&lt;br /&gt;
&lt;br /&gt;
Note that special roles are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage IsAdministrator listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows for custom CSS for special roles&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   .IsAdministrator h1 { color: red; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Other functions==&lt;br /&gt;
&lt;br /&gt;
=== selectSingleOption(fieldName) ===&lt;br /&gt;
Will set a value if only one option is avaiable in a select box.&lt;br /&gt;
&lt;br /&gt;
=== warnDateAfterOtherDate( dateA, dateZ, message ) ===&lt;br /&gt;
Alerts the user via a popup, if two dates are not after each other. Both date changes triggers the test.&lt;br /&gt;
&lt;br /&gt;
=== disableErrorCountInTitle() and enableErrorCountInTitle() (6734+) ===&lt;br /&gt;
Will disable/enable displaying of numbers of errors i the page-title. Default is enabled&lt;br /&gt;
&lt;br /&gt;
=== changeFieldToShow(fieldName) ===&lt;br /&gt;
Remove input and select boxes and replace them with the value in the field&lt;br /&gt;
&lt;br /&gt;
=== showMoreTableRows(fieldName,rowsShown,buttonLabel) ===&lt;br /&gt;
Makes a nested table shorter by hiding lines &amp;gt; rowsShown. Hidden rows can be shown with the button below the table.&lt;br /&gt;
&lt;br /&gt;
=Control variables=&lt;br /&gt;
TS uses a number of special variables to control the behavior of the frontend. These variables can be changed anywhere.&lt;br /&gt;
&lt;br /&gt;
===Opening new windows===&lt;br /&gt;
Window default sizes are controlled by the following variables&lt;br /&gt;
*'''tsOpenWindowHeight''' = 680;&lt;br /&gt;
*'''tsOpenWindowWidth'''  = 820;&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===Dependency hiding fields ===&lt;br /&gt;
'''hideTableRowsForElements''' is by default true. &lt;br /&gt;
&lt;br /&gt;
Set to false if template structure is only in a single level.&lt;br /&gt;
*true: Hide two parent nodes when hiding fields&lt;br /&gt;
*false: Hide single parent node when hiding fields&lt;br /&gt;
&lt;br /&gt;
Example of 2 level template (default)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example of 1 level template (special cases)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
  &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
=Other sources=&lt;br /&gt;
&lt;br /&gt;
*[[JQUERY / SCRIPT CHEATSHEET| Readonly radiobuttons, copy text in field, build selectbox from service ...]]&lt;br /&gt;
*[[HACKING DEPENDENT VALUES| Handling dependent lookup values (showing all elements etc.)]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Features&amp;diff=7276</id>
		<title>Features</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Features&amp;diff=7276"/>
		<updated>2025-06-06T07:58:07Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Special features */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Click to read [[What is Tempus Serva|graphic figure models]] or [http://www.tempusserva.dk/temptree/index.html Interactive feature map]&lt;br /&gt;
&lt;br /&gt;
== Components ==&lt;br /&gt;
* [[Features/Dashboards|Dashboards (BI)]]&lt;br /&gt;
* [[Features/Relational database|Relational database]]&lt;br /&gt;
* [[Features/Workflow engine|Workflow engine]]&lt;br /&gt;
* [[Features/Access control|Access control]]&lt;br /&gt;
* [[Features/File managment|File managment]]&lt;br /&gt;
&lt;br /&gt;
== User interface ==&lt;br /&gt;
* [[Features/Advanced input forms|Advanced input forms]]&lt;br /&gt;
* [[Features/Data reports|Data reporting]]&lt;br /&gt;
* [[Features/Customized design|Customized design]]&lt;br /&gt;
* [[Features/Questionaires|Questionaires]]&lt;br /&gt;
* [[Features/Internationalization|Multi language (I18N)]]&lt;br /&gt;
* [[Features/Multi device|Multi device (responsive design)]]&lt;br /&gt;
&lt;br /&gt;
== Technical features ==&lt;br /&gt;
* [[Features/Compliance|Compliance]]&lt;br /&gt;
* [[Elastic_search#Install|Full-text search]]&lt;br /&gt;
* [[Integration/REST|REST webservice]]&lt;br /&gt;
* [[Features/Multi tenancy|Multi tenancy]]&lt;br /&gt;
* [[Security_setup#Compliance_built-in|Logging and history]]&lt;br /&gt;
* [[Features/Custom code|Custom code]]&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
* [[Features/Single signon|Single Signon (SSO)]]&lt;br /&gt;
* [[Features/MitID og Eboks|MitID og Eboks]]&lt;br /&gt;
* [[Features/File_managment#Document_signing|Document signing]]&lt;br /&gt;
* [[Integration#Scheduled_data_imports|External data sources]]&lt;br /&gt;
* [[Features/Website integration|Website integration]]&lt;br /&gt;
* [[Data_import_and_export|Import / Export data]]&lt;br /&gt;
&lt;br /&gt;
== Special features ==&lt;br /&gt;
* [[Features/QR and NFC actions|QR and NFC actions]]&lt;br /&gt;
* [[Features/AI conversion|AI conversion]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Features&amp;diff=7275</id>
		<title>Features</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Features&amp;diff=7275"/>
		<updated>2025-06-06T07:56:32Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Special features */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Click to read [[What is Tempus Serva|graphic figure models]] or [http://www.tempusserva.dk/temptree/index.html Interactive feature map]&lt;br /&gt;
&lt;br /&gt;
== Components ==&lt;br /&gt;
* [[Features/Dashboards|Dashboards (BI)]]&lt;br /&gt;
* [[Features/Relational database|Relational database]]&lt;br /&gt;
* [[Features/Workflow engine|Workflow engine]]&lt;br /&gt;
* [[Features/Access control|Access control]]&lt;br /&gt;
* [[Features/File managment|File managment]]&lt;br /&gt;
&lt;br /&gt;
== User interface ==&lt;br /&gt;
* [[Features/Advanced input forms|Advanced input forms]]&lt;br /&gt;
* [[Features/Data reports|Data reporting]]&lt;br /&gt;
* [[Features/Customized design|Customized design]]&lt;br /&gt;
* [[Features/Questionaires|Questionaires]]&lt;br /&gt;
* [[Features/Internationalization|Multi language (I18N)]]&lt;br /&gt;
* [[Features/Multi device|Multi device (responsive design)]]&lt;br /&gt;
&lt;br /&gt;
== Technical features ==&lt;br /&gt;
* [[Features/Compliance|Compliance]]&lt;br /&gt;
* [[Elastic_search#Install|Full-text search]]&lt;br /&gt;
* [[Integration/REST|REST webservice]]&lt;br /&gt;
* [[Features/Multi tenancy|Multi tenancy]]&lt;br /&gt;
* [[Security_setup#Compliance_built-in|Logging and history]]&lt;br /&gt;
* [[Features/Custom code|Custom code]]&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
* [[Features/Single signon|Single Signon (SSO)]]&lt;br /&gt;
* [[Features/MitID og Eboks|MitID og Eboks]]&lt;br /&gt;
* [[Features/File_managment#Document_signing|Document signing]]&lt;br /&gt;
* [[Integration#Scheduled_data_imports|External data sources]]&lt;br /&gt;
* [[Features/Website integration|Website integration]]&lt;br /&gt;
* [[Data_import_and_export|Import / Export data]]&lt;br /&gt;
&lt;br /&gt;
== Special features ==&lt;br /&gt;
* [[Features/QR and NFC actions|QR and NFC actions]]&lt;br /&gt;
* [[Features/AI conversion|AI conversion]]&lt;br /&gt;
* [[Security_setup|OWASP compliance]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Security_setup&amp;diff=7274</id>
		<title>Security setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Security_setup&amp;diff=7274"/>
		<updated>2025-06-06T07:55:19Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Multi-factor Authentication (recommended) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Security baseline ==&lt;br /&gt;
&lt;br /&gt;
=== Security by design ===&lt;br /&gt;
The platform is security designed in accordance with [https://owasp.org/www-pdf-archive/OWASP_Application_Security_Verification_Standard_4.0-en.pdf OWASP version 4]:&lt;br /&gt;
* Level 2: Compliant&lt;br /&gt;
* Level 3: +90% supported&lt;br /&gt;
&lt;br /&gt;
In addition the platform supports a wide range of security schemes and logging features, needed for support of ISO27001, ISAE3000 etc.&lt;br /&gt;
&lt;br /&gt;
The platform is subject to periodic penetration testing. Last customer testing was july 2021.&lt;br /&gt;
&lt;br /&gt;
===Default security ===&lt;br /&gt;
By default the Tempus Serva is verifiably secure to all common threat vectors, such as &lt;br /&gt;
* SQL injection&lt;br /&gt;
* Cross-Site Scripting&lt;br /&gt;
* Session highjacking&lt;br /&gt;
* Login replays&lt;br /&gt;
* [https://owasp.org/www-project-top-ten/ etc]&lt;br /&gt;
&lt;br /&gt;
Protective measure includes common hardening efforts, such as&lt;br /&gt;
* Data sanitization&lt;br /&gt;
* Request throtling&lt;br /&gt;
* CSRF tokens&lt;br /&gt;
* [https://owasp.org/www-pdf-archive/OWASP_Application_Security_Verification_Standard_4.0-en.pdf etc]&lt;br /&gt;
&lt;br /&gt;
In addition to this baseline additional features can be activated per installation.&lt;br /&gt;
* Built-in: Features in the product itself&lt;br /&gt;
* External: Measures controlled in application server or operating system&lt;br /&gt;
&lt;br /&gt;
== Security built-in ==&lt;br /&gt;
&lt;br /&gt;
=== Password Policies (recommended) ===&lt;br /&gt;
TS No-code Platform allows you to setup and enfoce the use of strong passwords through an appropriate password policy. Specify attribute requirements that control complexity and lifetime of passwords such as:&lt;br /&gt;
* Mimimum password length&lt;br /&gt;
* Special characters&lt;br /&gt;
* Maximum password age&lt;br /&gt;
* Maximum number of tries&lt;br /&gt;
&lt;br /&gt;
The struictural restrictions will be honored when&lt;br /&gt;
* The user changes his password&lt;br /&gt;
* A new randow password is generated and sent&lt;br /&gt;
&lt;br /&gt;
Passwords can also be set to expire after an amount of time.&lt;br /&gt;
&lt;br /&gt;
'''How to:''' The polices can be changed in server configurations  in the group ''Password policies''&lt;br /&gt;
&lt;br /&gt;
'''Note:''' The password polices will have no impact on SSO authentication&lt;br /&gt;
&lt;br /&gt;
=== Multi-factor Authentication (recommended) ===&lt;br /&gt;
&lt;br /&gt;
==== Device MFA ====&lt;br /&gt;
TS No-code Platform offers native Multi-factor Authentication to protect against unauthrised access by requiring a user to provide multiple authentication factors to prove their identity. At present two different options are available:&lt;br /&gt;
* MFA using session-specific, one-time-passcodes sent to the users mobile phone via regular or Flash SMS&lt;br /&gt;
** You will need to create an account for sending SMS &lt;br /&gt;
** Cost is approx. 0,30 DKK per message)&lt;br /&gt;
* MFA using af dedicated app from&lt;br /&gt;
** Apple&lt;br /&gt;
** Google&lt;br /&gt;
** Microsoft&lt;br /&gt;
&lt;br /&gt;
SMS requires very little of the users, while App based MFA is considered (slightly) more secure.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If using singlesignon (SSO) the MFA will not be used&lt;br /&gt;
&lt;br /&gt;
==== Location MFA====&lt;br /&gt;
IP can be used as factor. In some cases slightly less secure, but much easier for the user.&lt;br /&gt;
&lt;br /&gt;
Options include&lt;br /&gt;
* Country whitelisting (via IP)&lt;br /&gt;
* Static whitelisting of IP's&lt;br /&gt;
* Adaptive whitelisting of IP's&lt;br /&gt;
&lt;br /&gt;
Adaptive whitelisting happens when the same user logs in from the same IP multiple times (typically 5). &lt;br /&gt;
&lt;br /&gt;
IP MFA can be used together with normal MFA, so that SMS/App check is only required in case the IP is not whitelistet.&lt;br /&gt;
&lt;br /&gt;
=== Geolocation blocking (optional) ===&lt;br /&gt;
Geoblocking will allow the servers to deny requests from certain countries.&lt;br /&gt;
&lt;br /&gt;
The geoblocking will match the clients IP against af Geo service. The county will be matched to the servers whitelist of country names.&lt;br /&gt;
&lt;br /&gt;
'''How to:''' Change the system configurations starting with ''ipBlocker''&lt;br /&gt;
* Activate setting '''ipBlockerActive'''&lt;br /&gt;
* Set allowed countries in '''	ipBlockerAllowedCountries'''&lt;br /&gt;
&lt;br /&gt;
=== Request throttling (optional) ===&lt;br /&gt;
As specified in OWASP v4 system should be able to limit the mount of request a user can carry out in a system.&lt;br /&gt;
&lt;br /&gt;
Limitations can be set on&lt;br /&gt;
* Pages hit&lt;br /&gt;
* WebDAV requests&lt;br /&gt;
* Upload (size/count)&lt;br /&gt;
* REST operations&lt;br /&gt;
&lt;br /&gt;
'''How to:''' Edit server configurations starting with ''limit''&lt;br /&gt;
&lt;br /&gt;
=== Brute force prevention (optional) ===&lt;br /&gt;
This protection is handled by not serving too many requests to the login page, regardless of the source in question.&lt;br /&gt;
This will prevent brute force attacks on distributed accounts using multiple machines. In case the detection triggers, login requests will be ignored for at set amount of time, while allready logged in users can continue their work.&lt;br /&gt;
&lt;br /&gt;
'''How to:''' Define systems configurations starting with ''bruteforce''&lt;br /&gt;
&lt;br /&gt;
=== Additional configurations ===&lt;br /&gt;
* File whitelisting (uploadWhitelist)&lt;br /&gt;
* OWASP compliance (owaspCompliance)&lt;br /&gt;
&lt;br /&gt;
== Security external ==&lt;br /&gt;
&lt;br /&gt;
=== Virus scanning ===&lt;br /&gt;
Scanning of uploaded fiels are left to software installed on the system.&lt;br /&gt;
&lt;br /&gt;
The upload feature will temporarily store the files on the file system, so that detection mechanisms can quarantine the files in case they are infected.&lt;br /&gt;
&lt;br /&gt;
=== Storage encryption ===&lt;br /&gt;
Storage encryption is normally supported by the underlying technologies, with the possible exception of password hashes (handled with BCrypt). &lt;br /&gt;
&lt;br /&gt;
MySQL (+8) supports multiple encryption schemes&lt;br /&gt;
* The whole database&lt;br /&gt;
* Single schema (each TS installation)&lt;br /&gt;
&lt;br /&gt;
Read more about encryption for [https://mysqlserverteam.com/controlling-table-encryption-in-mysql-8-0/ MySQL] and [https://mariadb.com/kb/en/data-at-rest-encryption-overview/ MariaDB]&lt;br /&gt;
&lt;br /&gt;
O/S level encryption technology includes&lt;br /&gt;
* Windows: BitLocker&lt;br /&gt;
* Linux: LUKS&lt;br /&gt;
&lt;br /&gt;
=== Transport encryption (https) ===&lt;br /&gt;
Minimum requirements are SSL certificates. On Linux these can easily be obtained for free via LetsEncrypt.&lt;br /&gt;
&lt;br /&gt;
Optionally the server can also apply to HSTS, using the following [https://www.javaprogramto.com/2018/09/adding-http-strict-transport.html guideline for Tomcat].&lt;br /&gt;
&lt;br /&gt;
=== Denial of service attacks ===&lt;br /&gt;
Protection against DOS attacks are best handled using dedicated services such as Cloudflare.&lt;br /&gt;
&lt;br /&gt;
== Compliance built-in ==&lt;br /&gt;
&lt;br /&gt;
=== Activity and data logging (optional) ===&lt;br /&gt;
Activity and Data Logging includes the automatic creation of a series of log files. Logging can be set up for each entity in an application providing insight and transparency in relation to: user activity, creation, changes and status of different records in an application. &lt;br /&gt;
* '''Access Log''': Can be activated on an entity in an application. This automatically generates a log of which users have accessed and/or edited a given record. &lt;br /&gt;
* '''Status Log''': Can be activated for an entity in an application. This automatically generates a log of the history of the created records, which shows how long a record has been in each status&lt;br /&gt;
* '''Change Log''': Can be activated for an entity in an application. This automatically generates a log of what changes have been made to the individual records. Including who has changed what and when (timestamp).&lt;br /&gt;
&lt;br /&gt;
'''How to:''' Each option is activated on the entity Advanced page.&lt;br /&gt;
&lt;br /&gt;
'''Pro tip:''' Especially the status log can be used for setting up performance charts on dashboards, as it can give detailed information of how much time was spent in each step.&lt;br /&gt;
&lt;br /&gt;
=== Versioning (optional) ===&lt;br /&gt;
By default file versioning is supported on the &amp;quot;Documents&amp;quot; and &amp;quot;Files&amp;quot; field types. In addition, data revisions can be supported on each entity. This automatically builds an audit log for each record.&lt;br /&gt;
&lt;br /&gt;
In addition data revisions can be supported on each individual entity.&lt;br /&gt;
&lt;br /&gt;
'''How to:''' Data revisions is activated on the entity Advanced page.&lt;br /&gt;
&lt;br /&gt;
=== GDPR Deletion Policies (optional) ===&lt;br /&gt;
For each entity in a TS Application, a GDPR Deletion Policy can be set up, enabling automatic deletion or anonymization in accordance with the specified rules. The application will thus automatically delete or anonymize data and files in the application, cf. specified criteria.&lt;br /&gt;
&lt;br /&gt;
'''How to:''' &lt;br /&gt;
# Set up an action on a entity status&lt;br /&gt;
# Check of deletion policy&lt;br /&gt;
# Choose between anonoumization or deletion&lt;br /&gt;
# Optionally select log data to also be deleted&lt;br /&gt;
&lt;br /&gt;
In case you choose &amp;quot;anonoumization&amp;quot; you should define how each field should be handled&lt;br /&gt;
# Click on a field&lt;br /&gt;
# Click on Assignment&lt;br /&gt;
# Check of anoumization&lt;br /&gt;
# Optionally set value after change&lt;br /&gt;
&lt;br /&gt;
=== Event and System Logging (recommended) ===&lt;br /&gt;
When Event and System Logging are turned on for an application, the following events are logged automatically: &lt;br /&gt;
* User logins&lt;br /&gt;
** Succesfull normal user logins are hidden&lt;br /&gt;
** Also contains client IP (used for MFA)&lt;br /&gt;
* System events&lt;br /&gt;
** User errors&lt;br /&gt;
** Scheduled services&lt;br /&gt;
** Administrator logins&lt;br /&gt;
&lt;br /&gt;
Error events will include stacktraces if available.&lt;br /&gt;
&lt;br /&gt;
The eventlog can be cleaned automatically on a regular schedule.&lt;br /&gt;
&lt;br /&gt;
== Compliance external ==&lt;br /&gt;
&lt;br /&gt;
=== Request logging ===&lt;br /&gt;
The webserver itself can be set up to do make detailed logs in file , containing for example&lt;br /&gt;
* Request timestamp, IP and session ID&lt;br /&gt;
* Stacktraces on errors&lt;br /&gt;
&lt;br /&gt;
Depending on your security setup you might want to log these to a central repository&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other optional security features ==&lt;br /&gt;
* [[Security/Data restrictions|Data restrictions]]&lt;br /&gt;
* [[Security/Encryption|SSL encryption]]&lt;br /&gt;
* [[Security/Bruteforce|Bruteforce countermeasures]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Features&amp;diff=7269</id>
		<title>Features</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Features&amp;diff=7269"/>
		<updated>2025-06-06T07:25:56Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Special features */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Click to read [[What is Tempus Serva|graphic figure models]] or [http://www.tempusserva.dk/temptree/index.html Interactive feature map]&lt;br /&gt;
&lt;br /&gt;
== Components ==&lt;br /&gt;
* [[Features/Dashboards|Dashboards (BI)]]&lt;br /&gt;
* [[Features/Relational database|Relational database]]&lt;br /&gt;
* [[Features/Workflow engine|Workflow engine]]&lt;br /&gt;
* [[Features/Access control|Access control]]&lt;br /&gt;
* [[Features/File managment|File managment]]&lt;br /&gt;
&lt;br /&gt;
== User interface ==&lt;br /&gt;
* [[Features/Advanced input forms|Advanced input forms]]&lt;br /&gt;
* [[Features/Data reports|Data reporting]]&lt;br /&gt;
* [[Features/Customized design|Customized design]]&lt;br /&gt;
* [[Features/Questionaires|Questionaires]]&lt;br /&gt;
* [[Features/Internationalization|Multi language (I18N)]]&lt;br /&gt;
* [[Features/Multi device|Multi device (responsive design)]]&lt;br /&gt;
&lt;br /&gt;
== Technical features ==&lt;br /&gt;
* [[Features/Compliance|Compliance]]&lt;br /&gt;
* [[Elastic_search#Install|Full-text search]]&lt;br /&gt;
* [[Integration/REST|REST webservice]]&lt;br /&gt;
* [[Features/Multi tenancy|Multi tenancy]]&lt;br /&gt;
* [[Security_setup#Compliance_built-in|Logging and history]]&lt;br /&gt;
* [[Features/Custom code|Custom code]]&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
* [[Features/Single signon|Single Signon (SSO)]]&lt;br /&gt;
* [[Features/MitID og Eboks|MitID og Eboks]]&lt;br /&gt;
* [[Features/File_managment#Document_signing|Document signing]]&lt;br /&gt;
* [[Integration#Scheduled_data_imports|External data sources]]&lt;br /&gt;
* [[Features/Website integration|Website integration]]&lt;br /&gt;
* [[Data_import_and_export|Import / Export data]]&lt;br /&gt;
&lt;br /&gt;
== Special features ==&lt;br /&gt;
* [[Features/QR and NFC actions|QR and NFC actions]]&lt;br /&gt;
* [[Features/AI conversion|AI conversion]]&lt;br /&gt;
* [[Features/OWASP compliance|OWASP compliance]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Features&amp;diff=7268</id>
		<title>Features</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Features&amp;diff=7268"/>
		<updated>2025-06-06T07:24:50Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Special features */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Click to read [[What is Tempus Serva|graphic figure models]] or [http://www.tempusserva.dk/temptree/index.html Interactive feature map]&lt;br /&gt;
&lt;br /&gt;
== Components ==&lt;br /&gt;
* [[Features/Dashboards|Dashboards (BI)]]&lt;br /&gt;
* [[Features/Relational database|Relational database]]&lt;br /&gt;
* [[Features/Workflow engine|Workflow engine]]&lt;br /&gt;
* [[Features/Access control|Access control]]&lt;br /&gt;
* [[Features/File managment|File managment]]&lt;br /&gt;
&lt;br /&gt;
== User interface ==&lt;br /&gt;
* [[Features/Advanced input forms|Advanced input forms]]&lt;br /&gt;
* [[Features/Data reports|Data reporting]]&lt;br /&gt;
* [[Features/Customized design|Customized design]]&lt;br /&gt;
* [[Features/Questionaires|Questionaires]]&lt;br /&gt;
* [[Features/Internationalization|Multi language (I18N)]]&lt;br /&gt;
* [[Features/Multi device|Multi device (responsive design)]]&lt;br /&gt;
&lt;br /&gt;
== Technical features ==&lt;br /&gt;
* [[Features/Compliance|Compliance]]&lt;br /&gt;
* [[Elastic_search#Install|Full-text search]]&lt;br /&gt;
* [[Integration/REST|REST webservice]]&lt;br /&gt;
* [[Features/Multi tenancy|Multi tenancy]]&lt;br /&gt;
* [[Security_setup#Compliance_built-in|Logging and history]]&lt;br /&gt;
* [[Features/Custom code|Custom code]]&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
* [[Features/Single signon|Single Signon (SSO)]]&lt;br /&gt;
* [[Features/MitID og Eboks|MitID og Eboks]]&lt;br /&gt;
* [[Features/File_managment#Document_signing|Document signing]]&lt;br /&gt;
* [[Integration#Scheduled_data_imports|External data sources]]&lt;br /&gt;
* [[Features/Website integration|Website integration]]&lt;br /&gt;
* [[Data_import_and_export|Import / Export data]]&lt;br /&gt;
&lt;br /&gt;
== Special features ==&lt;br /&gt;
* [[Features/QR and NFC actions|QR and NFC actions]]&lt;br /&gt;
* [[Features/AI conversion|AI conversion]]&lt;br /&gt;
* [[Features/Security measures|Security measures]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Features&amp;diff=7267</id>
		<title>Features</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Features&amp;diff=7267"/>
		<updated>2025-06-06T07:23:57Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Special features */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Click to read [[What is Tempus Serva|graphic figure models]] or [http://www.tempusserva.dk/temptree/index.html Interactive feature map]&lt;br /&gt;
&lt;br /&gt;
== Components ==&lt;br /&gt;
* [[Features/Dashboards|Dashboards (BI)]]&lt;br /&gt;
* [[Features/Relational database|Relational database]]&lt;br /&gt;
* [[Features/Workflow engine|Workflow engine]]&lt;br /&gt;
* [[Features/Access control|Access control]]&lt;br /&gt;
* [[Features/File managment|File managment]]&lt;br /&gt;
&lt;br /&gt;
== User interface ==&lt;br /&gt;
* [[Features/Advanced input forms|Advanced input forms]]&lt;br /&gt;
* [[Features/Data reports|Data reporting]]&lt;br /&gt;
* [[Features/Customized design|Customized design]]&lt;br /&gt;
* [[Features/Questionaires|Questionaires]]&lt;br /&gt;
* [[Features/Internationalization|Multi language (I18N)]]&lt;br /&gt;
* [[Features/Multi device|Multi device (responsive design)]]&lt;br /&gt;
&lt;br /&gt;
== Technical features ==&lt;br /&gt;
* [[Features/Compliance|Compliance]]&lt;br /&gt;
* [[Elastic_search#Install|Full-text search]]&lt;br /&gt;
* [[Integration/REST|REST webservice]]&lt;br /&gt;
* [[Features/Multi tenancy|Multi tenancy]]&lt;br /&gt;
* [[Security_setup#Compliance_built-in|Logging and history]]&lt;br /&gt;
* [[Features/Custom code|Custom code]]&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
* [[Features/Single signon|Single Signon (SSO)]]&lt;br /&gt;
* [[Features/MitID og Eboks|MitID og Eboks]]&lt;br /&gt;
* [[Features/File_managment#Document_signing|Document signing]]&lt;br /&gt;
* [[Integration#Scheduled_data_imports|External data sources]]&lt;br /&gt;
* [[Features/Website integration|Website integration]]&lt;br /&gt;
* [[Data_import_and_export|Import / Export data]]&lt;br /&gt;
&lt;br /&gt;
== Special features ==&lt;br /&gt;
* [[Features/QR and NFC actions|QR and NFC actions]]&lt;br /&gt;
* [[Features/AI conversion|AI conversion]]&lt;br /&gt;
* [[Features/Multifactor authentication|Multifactor authentication]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Coding_standards&amp;diff=7266</id>
		<title>Coding standards</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Coding_standards&amp;diff=7266"/>
		<updated>2025-05-21T10:39:11Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Table naming */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Naming standards ==&lt;br /&gt;
&lt;br /&gt;
=== Code naming standards ===&lt;br /&gt;
&lt;br /&gt;
==== Package / naming placement ====&lt;br /&gt;
* Package name all lowercase&lt;br /&gt;
* General platform entities&lt;br /&gt;
** Servlets: '''com.tsnocode.server.servlet'''&lt;br /&gt;
**Filters: '''com.tsnocode.server.filter'''&lt;br /&gt;
**Core: '''com.tsnocode.ui''' &lt;br /&gt;
** Fields: '''com.tsnocode.ui.field.&amp;lt;group&amp;gt;'''&lt;br /&gt;
** Views: '''com.tsnocode.ui.views.&amp;lt;type&amp;gt;  (item,list,statistics,)'''&lt;br /&gt;
**Codeunit: '''com.tsnocode.codeunit.common'''&lt;br /&gt;
* Solution specific code&lt;br /&gt;
** TS customer app: &lt;br /&gt;
*** '''com.tsnocode.solution.app'''&lt;br /&gt;
*** '''com.tsnocode.solution.customer'''&lt;br /&gt;
*** '''com.tsnocode.solution.customer.app'''&lt;br /&gt;
** Vendor app: &lt;br /&gt;
*** '''com.vendor.tsnocode.app'''&lt;br /&gt;
*** '''com.vendor.solution.app'''&lt;br /&gt;
&lt;br /&gt;
==== Class naming ====&lt;br /&gt;
Naming convention follows Java standard&lt;br /&gt;
* Starting with uppercase&lt;br /&gt;
* No special characters&lt;br /&gt;
* Seperate words with uppercase&lt;br /&gt;
&lt;br /&gt;
In addition the following are recommended&lt;br /&gt;
* CodeunitPage post fix name &amp;quot;Page&amp;quot;&lt;br /&gt;
* CodeunitService post fix name &amp;quot;Service&amp;quot;&lt;br /&gt;
* Shared ressources include &amp;quot;Helper&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Database naming standards ===&lt;br /&gt;
&lt;br /&gt;
==== Table naming ====&lt;br /&gt;
&lt;br /&gt;
System tables should follow this syntax&lt;br /&gt;
* lowercase&lt;br /&gt;
* no special characters&lt;br /&gt;
* singular form (cow, not cows)&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes include&lt;br /&gt;
* data_&lt;br /&gt;
* _data_ (deleted tables)&lt;br /&gt;
&lt;br /&gt;
==== Table attribute naming ====&lt;br /&gt;
General rules&lt;br /&gt;
* Starts uppercase&lt;br /&gt;
* Next word in name starts with uppercase (eg ThisIsAnExample)&lt;br /&gt;
* Foreign keys ends with ID (eg UserID)&lt;br /&gt;
&lt;br /&gt;
Changelog attributes fixed names&lt;br /&gt;
* CreatedAt&lt;br /&gt;
* CreatedBy&lt;br /&gt;
* ModifiedAt&lt;br /&gt;
* ModifiedBy&lt;br /&gt;
* FinalizedAt&lt;br /&gt;
* FinalizedBy&lt;br /&gt;
&lt;br /&gt;
== Compliance standards ==&lt;br /&gt;
The platform must be able to run on&lt;br /&gt;
* Current versions of Java&lt;br /&gt;
* Current versions of Tomcat&lt;br /&gt;
* MySQL and MariaDB&lt;br /&gt;
** Do not use current_timestamp (property)&lt;br /&gt;
&lt;br /&gt;
== Safety standards ==&lt;br /&gt;
* Input sanitization used in SQL, using either &lt;br /&gt;
** Escape all string parameters using DbConnection.EscapeSQL&lt;br /&gt;
** Prepared statements &lt;br /&gt;
* All Page codeunits should contain some user group restrictions, and set to be default off&lt;br /&gt;
&lt;br /&gt;
== Review standards ==&lt;br /&gt;
The following changes requires a formal code review&lt;br /&gt;
* Changes to the API&lt;br /&gt;
* Changes to common objects&lt;br /&gt;
** Command&lt;br /&gt;
** Security&lt;br /&gt;
** Controller&lt;br /&gt;
** DbConnection&lt;br /&gt;
* Creation of OR changes to&lt;br /&gt;
** Servlets&lt;br /&gt;
** Servlet Filters&lt;br /&gt;
** CodeunitPagePublic&lt;br /&gt;
** Code containing SQL&lt;br /&gt;
* Any code that&lt;br /&gt;
** Deletes DB columns OR tables&lt;br /&gt;
&lt;br /&gt;
== Test cases ==&lt;br /&gt;
&lt;br /&gt;
=== Test cases Fields ===&lt;br /&gt;
* Commands: list, show, edit (update)&lt;br /&gt;
* List interactions: Sort, Grouping&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Coding_standards&amp;diff=7265</id>
		<title>Coding standards</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Coding_standards&amp;diff=7265"/>
		<updated>2025-05-06T08:25:11Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Review standards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Naming standards ==&lt;br /&gt;
&lt;br /&gt;
=== Code naming standards ===&lt;br /&gt;
&lt;br /&gt;
==== Package / naming placement ====&lt;br /&gt;
* Package name all lowercase&lt;br /&gt;
* General platform entities&lt;br /&gt;
** Servlets: '''com.tsnocode.server.servlet'''&lt;br /&gt;
**Filters: '''com.tsnocode.server.filter'''&lt;br /&gt;
**Core: '''com.tsnocode.ui''' &lt;br /&gt;
** Fields: '''com.tsnocode.ui.field.&amp;lt;group&amp;gt;'''&lt;br /&gt;
** Views: '''com.tsnocode.ui.views.&amp;lt;type&amp;gt;  (item,list,statistics,)'''&lt;br /&gt;
**Codeunit: '''com.tsnocode.codeunit.common'''&lt;br /&gt;
* Solution specific code&lt;br /&gt;
** TS customer app: &lt;br /&gt;
*** '''com.tsnocode.solution.app'''&lt;br /&gt;
*** '''com.tsnocode.solution.customer'''&lt;br /&gt;
*** '''com.tsnocode.solution.customer.app'''&lt;br /&gt;
** Vendor app: &lt;br /&gt;
*** '''com.vendor.tsnocode.app'''&lt;br /&gt;
*** '''com.vendor.solution.app'''&lt;br /&gt;
&lt;br /&gt;
==== Class naming ====&lt;br /&gt;
Naming convention follows Java standard&lt;br /&gt;
* Starting with uppercase&lt;br /&gt;
* No special characters&lt;br /&gt;
* Seperate words with uppercase&lt;br /&gt;
&lt;br /&gt;
In addition the following are recommended&lt;br /&gt;
* CodeunitPage post fix name &amp;quot;Page&amp;quot;&lt;br /&gt;
* CodeunitService post fix name &amp;quot;Service&amp;quot;&lt;br /&gt;
* Shared ressources include &amp;quot;Helper&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Database naming standards ===&lt;br /&gt;
&lt;br /&gt;
==== Table naming ====&lt;br /&gt;
&lt;br /&gt;
System tables should follow this syntax&lt;br /&gt;
* lowercase&lt;br /&gt;
* no special characters&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes include&lt;br /&gt;
* data_&lt;br /&gt;
* _data_ (deleted tables)&lt;br /&gt;
&lt;br /&gt;
==== Table attribute naming ====&lt;br /&gt;
General rules&lt;br /&gt;
* Starts uppercase&lt;br /&gt;
* Next word in name starts with uppercase (eg ThisIsAnExample)&lt;br /&gt;
* Foreign keys ends with ID (eg UserID)&lt;br /&gt;
&lt;br /&gt;
Changelog attributes fixed names&lt;br /&gt;
* CreatedAt&lt;br /&gt;
* CreatedBy&lt;br /&gt;
* ModifiedAt&lt;br /&gt;
* ModifiedBy&lt;br /&gt;
* FinalizedAt&lt;br /&gt;
* FinalizedBy&lt;br /&gt;
&lt;br /&gt;
== Compliance standards ==&lt;br /&gt;
The platform must be able to run on&lt;br /&gt;
* Current versions of Java&lt;br /&gt;
* Current versions of Tomcat&lt;br /&gt;
* MySQL and MariaDB&lt;br /&gt;
** Do not use current_timestamp (property)&lt;br /&gt;
&lt;br /&gt;
== Safety standards ==&lt;br /&gt;
* Input sanitization used in SQL, using either &lt;br /&gt;
** Escape all string parameters using DbConnection.EscapeSQL&lt;br /&gt;
** Prepared statements &lt;br /&gt;
* All Page codeunits should contain some user group restrictions, and set to be default off&lt;br /&gt;
&lt;br /&gt;
== Review standards ==&lt;br /&gt;
The following changes requires a formal code review&lt;br /&gt;
* Changes to the API&lt;br /&gt;
* Changes to common objects&lt;br /&gt;
** Command&lt;br /&gt;
** Security&lt;br /&gt;
** Controller&lt;br /&gt;
** DbConnection&lt;br /&gt;
* Creation of OR changes to&lt;br /&gt;
** Servlets&lt;br /&gt;
** Servlet Filters&lt;br /&gt;
** CodeunitPagePublic&lt;br /&gt;
** Code containing SQL&lt;br /&gt;
* Any code that&lt;br /&gt;
** Deletes DB columns OR tables&lt;br /&gt;
&lt;br /&gt;
== Test cases ==&lt;br /&gt;
&lt;br /&gt;
=== Test cases Fields ===&lt;br /&gt;
* Commands: list, show, edit (update)&lt;br /&gt;
* List interactions: Sort, Grouping&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7263</id>
		<title>Course notes for today</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7263"/>
		<updated>2025-04-08T06:37:11Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Extra for today */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Slides for today ==&lt;br /&gt;
https://www.tempusserva.dk/share/training/PFM300.pdf&lt;br /&gt;
&lt;br /&gt;
== Servers for today ==&lt;br /&gt;
&lt;br /&gt;
Servers &lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi1/login JONAS&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi2/login LAURITS&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi3/login CHRISTOFFER&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi4/login MARK&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi5/login MORTEN&lt;br /&gt;
&lt;br /&gt;
Credentials&lt;br /&gt;
* username: admin&lt;br /&gt;
* password: [on whiteboard]&lt;br /&gt;
&lt;br /&gt;
== Setting up DEV environment ==&lt;br /&gt;
Downloads&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/tsnocodeApi.jar&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/TempusServa.war&lt;br /&gt;
&lt;br /&gt;
For placement in the lib folder (ALL) &lt;br /&gt;
* https://www.tempusserva.dk/install/driver/mysql-connector-java-5.1.45-bin.jar&lt;br /&gt;
* https://www.tempusserva.dk/install/driver/commons-logging-1.1.1.jar&lt;br /&gt;
&lt;br /&gt;
== Related articles ==&lt;br /&gt;
* https://wiki.tempusserva.dk/index.php?title=Installation_Windows#MySQL_database&lt;br /&gt;
&lt;br /&gt;
Sample create user SQL &lt;br /&gt;
* CREATE USER 'tsinstall'@'*' IDENTIFIED BY 'TempusServa';&lt;br /&gt;
* GRANT ALL PRIVILEGES ON *.* TO 'tsinstall'@'*' WITH GRANT OPTION;&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7262</id>
		<title>Course notes for today</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7262"/>
		<updated>2025-04-02T12:12:27Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Extra for today */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Slides for today ==&lt;br /&gt;
https://www.tempusserva.dk/share/training/PFM300.pdf&lt;br /&gt;
&lt;br /&gt;
== Extra for today ==&lt;br /&gt;
https://builds.tsnocode.com/Debian12-Dev.ova&lt;br /&gt;
&lt;br /&gt;
SMTP setup&lt;br /&gt;
* mail.smtp2go.com&lt;br /&gt;
* exopi@tsnocode.com&lt;br /&gt;
* D9XR2LEWhCoNAszrBANAN&lt;br /&gt;
&lt;br /&gt;
== Servers for today ==&lt;br /&gt;
&lt;br /&gt;
Servers &lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi1/login JONAS&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi2/login LAURITS&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi3/login CHRISTOFFER&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi4/login MARK&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi5/login MORTEN&lt;br /&gt;
&lt;br /&gt;
Credentials&lt;br /&gt;
* username: admin&lt;br /&gt;
* password: [on whiteboard]&lt;br /&gt;
&lt;br /&gt;
== Setting up DEV environment ==&lt;br /&gt;
Downloads&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/tsnocodeApi.jar&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/TempusServa.war&lt;br /&gt;
&lt;br /&gt;
For placement in the lib folder (ALL) &lt;br /&gt;
* https://www.tempusserva.dk/install/driver/mysql-connector-java-5.1.45-bin.jar&lt;br /&gt;
* https://www.tempusserva.dk/install/driver/commons-logging-1.1.1.jar&lt;br /&gt;
&lt;br /&gt;
== Related articles ==&lt;br /&gt;
* https://wiki.tempusserva.dk/index.php?title=Installation_Windows#MySQL_database&lt;br /&gt;
&lt;br /&gt;
Sample create user SQL &lt;br /&gt;
* CREATE USER 'tsinstall'@'*' IDENTIFIED BY 'TempusServa';&lt;br /&gt;
* GRANT ALL PRIVILEGES ON *.* TO 'tsinstall'@'*' WITH GRANT OPTION;&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7261</id>
		<title>Course notes for today</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7261"/>
		<updated>2025-04-02T12:12:12Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Slides for today */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Slides for today ==&lt;br /&gt;
https://www.tempusserva.dk/share/training/PFM300.pdf&lt;br /&gt;
&lt;br /&gt;
== Extra for today ==&lt;br /&gt;
https://builds.tsnocode.com/Debian12-Dev.ova&lt;br /&gt;
&lt;br /&gt;
* mail.smtp2go.com&lt;br /&gt;
* exopi@tsnocode.com&lt;br /&gt;
* D9XR2LEWhCoNAszrBANAN&lt;br /&gt;
&lt;br /&gt;
== Servers for today ==&lt;br /&gt;
&lt;br /&gt;
Servers &lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi1/login JONAS&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi2/login LAURITS&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi3/login CHRISTOFFER&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi4/login MARK&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi5/login MORTEN&lt;br /&gt;
&lt;br /&gt;
Credentials&lt;br /&gt;
* username: admin&lt;br /&gt;
* password: [on whiteboard]&lt;br /&gt;
&lt;br /&gt;
== Setting up DEV environment ==&lt;br /&gt;
Downloads&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/tsnocodeApi.jar&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/TempusServa.war&lt;br /&gt;
&lt;br /&gt;
For placement in the lib folder (ALL) &lt;br /&gt;
* https://www.tempusserva.dk/install/driver/mysql-connector-java-5.1.45-bin.jar&lt;br /&gt;
* https://www.tempusserva.dk/install/driver/commons-logging-1.1.1.jar&lt;br /&gt;
&lt;br /&gt;
== Related articles ==&lt;br /&gt;
* https://wiki.tempusserva.dk/index.php?title=Installation_Windows#MySQL_database&lt;br /&gt;
&lt;br /&gt;
Sample create user SQL &lt;br /&gt;
* CREATE USER 'tsinstall'@'*' IDENTIFIED BY 'TempusServa';&lt;br /&gt;
* GRANT ALL PRIVILEGES ON *.* TO 'tsinstall'@'*' WITH GRANT OPTION;&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7260</id>
		<title>Course notes for today</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7260"/>
		<updated>2025-04-02T09:20:05Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Slides for today */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Slides for today ==&lt;br /&gt;
https://www.tempusserva.dk/share/training/PFM300.pdf&lt;br /&gt;
&lt;br /&gt;
https://builds.tsnocode.com/Debian12-Dev.ova&lt;br /&gt;
&lt;br /&gt;
== Servers for today ==&lt;br /&gt;
&lt;br /&gt;
Servers &lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi1/login JONAS&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi2/login LAURITS&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi3/login CHRISTOFFER&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi4/login MARK&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi5/login MORTEN&lt;br /&gt;
&lt;br /&gt;
Credentials&lt;br /&gt;
* username: admin&lt;br /&gt;
* password: [on whiteboard]&lt;br /&gt;
&lt;br /&gt;
== Setting up DEV environment ==&lt;br /&gt;
Downloads&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/tsnocodeApi.jar&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/TempusServa.war&lt;br /&gt;
&lt;br /&gt;
For placement in the lib folder (ALL) &lt;br /&gt;
* https://www.tempusserva.dk/install/driver/mysql-connector-java-5.1.45-bin.jar&lt;br /&gt;
* https://www.tempusserva.dk/install/driver/commons-logging-1.1.1.jar&lt;br /&gt;
&lt;br /&gt;
== Related articles ==&lt;br /&gt;
* https://wiki.tempusserva.dk/index.php?title=Installation_Windows#MySQL_database&lt;br /&gt;
&lt;br /&gt;
Sample create user SQL &lt;br /&gt;
* CREATE USER 'tsinstall'@'*' IDENTIFIED BY 'TempusServa';&lt;br /&gt;
* GRANT ALL PRIVILEGES ON *.* TO 'tsinstall'@'*' WITH GRANT OPTION;&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7258</id>
		<title>Course notes for today</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7258"/>
		<updated>2025-03-26T08:18:03Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Servers for today */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Slides for today ==&lt;br /&gt;
https://www.tempusserva.dk/share/training/PFM300.pdf&lt;br /&gt;
&lt;br /&gt;
== Servers for today ==&lt;br /&gt;
&lt;br /&gt;
Servers &lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi1/login JONAS&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi2/login LAURITS&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi3/login CHRISTOFFER&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi4/login MARK&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi5/login MORTEN&lt;br /&gt;
&lt;br /&gt;
Credentials&lt;br /&gt;
* username: admin&lt;br /&gt;
* password: [on whiteboard]&lt;br /&gt;
&lt;br /&gt;
== Setting up DEV environment ==&lt;br /&gt;
Downloads&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/tsnocodeApi.jar&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/TempusServa.war&lt;br /&gt;
&lt;br /&gt;
For placement in the lib folder (ALL) &lt;br /&gt;
* https://www.tempusserva.dk/install/driver/mysql-connector-java-5.1.45-bin.jar&lt;br /&gt;
* https://www.tempusserva.dk/install/driver/commons-logging-1.1.1.jar&lt;br /&gt;
&lt;br /&gt;
== Related articles ==&lt;br /&gt;
* https://wiki.tempusserva.dk/index.php?title=Installation_Windows#MySQL_database&lt;br /&gt;
&lt;br /&gt;
Sample create user SQL &lt;br /&gt;
* CREATE USER 'tsinstall'@'*' IDENTIFIED BY 'TempusServa';&lt;br /&gt;
* GRANT ALL PRIVILEGES ON *.* TO 'tsinstall'@'*' WITH GRANT OPTION;&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7257</id>
		<title>Course notes for today</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7257"/>
		<updated>2025-03-25T23:53:35Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Servers for today */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Slides for today ==&lt;br /&gt;
https://www.tempusserva.dk/share/training/PFM300.pdf&lt;br /&gt;
&lt;br /&gt;
== Servers for today ==&lt;br /&gt;
&lt;br /&gt;
Servers &lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi1/login&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi2/login&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi3/login&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi4/login&lt;br /&gt;
* https://trainingv3.tsnocode.com/exopi5/login&lt;br /&gt;
&lt;br /&gt;
Credentials&lt;br /&gt;
* username: admin&lt;br /&gt;
* password: [on whiteboard]&lt;br /&gt;
&lt;br /&gt;
== Setting up DEV environment ==&lt;br /&gt;
Downloads&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/tsnocodeApi.jar&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/TempusServa.war&lt;br /&gt;
&lt;br /&gt;
For placement in the lib folder (ALL) &lt;br /&gt;
* https://www.tempusserva.dk/install/driver/mysql-connector-java-5.1.45-bin.jar&lt;br /&gt;
* https://www.tempusserva.dk/install/driver/commons-logging-1.1.1.jar&lt;br /&gt;
&lt;br /&gt;
== Related articles ==&lt;br /&gt;
* https://wiki.tempusserva.dk/index.php?title=Installation_Windows#MySQL_database&lt;br /&gt;
&lt;br /&gt;
Sample create user SQL &lt;br /&gt;
* CREATE USER 'tsinstall'@'*' IDENTIFIED BY 'TempusServa';&lt;br /&gt;
* GRANT ALL PRIVILEGES ON *.* TO 'tsinstall'@'*' WITH GRANT OPTION;&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7256</id>
		<title>Course notes for today</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Course_notes_for_today&amp;diff=7256"/>
		<updated>2025-03-25T23:27:56Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Servers for today */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Slides for today ==&lt;br /&gt;
https://www.tempusserva.dk/share/training/PFM300.pdf&lt;br /&gt;
&lt;br /&gt;
== Servers for today ==&lt;br /&gt;
&lt;br /&gt;
Servers &lt;br /&gt;
* http://training.tsnocode.com/exopi1/login&lt;br /&gt;
* http://training.tsnocode.com/exopi2/login&lt;br /&gt;
* http://training.tsnocode.com/exopi3/login&lt;br /&gt;
* http://training.tsnocode.com/exopi4/login&lt;br /&gt;
* http://training.tsnocode.com/exopi5/login&lt;br /&gt;
&lt;br /&gt;
Credentials&lt;br /&gt;
* username: admin&lt;br /&gt;
* password: [on whiteboard]&lt;br /&gt;
&lt;br /&gt;
== Setting up DEV environment ==&lt;br /&gt;
Downloads&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/tsnocodeApi.jar&lt;br /&gt;
* https://omega.tempusserva.dk/nightly/TempusServa.war&lt;br /&gt;
&lt;br /&gt;
For placement in the lib folder (ALL) &lt;br /&gt;
* https://www.tempusserva.dk/install/driver/mysql-connector-java-5.1.45-bin.jar&lt;br /&gt;
* https://www.tempusserva.dk/install/driver/commons-logging-1.1.1.jar&lt;br /&gt;
&lt;br /&gt;
== Related articles ==&lt;br /&gt;
* https://wiki.tempusserva.dk/index.php?title=Installation_Windows#MySQL_database&lt;br /&gt;
&lt;br /&gt;
Sample create user SQL &lt;br /&gt;
* CREATE USER 'tsinstall'@'*' IDENTIFIED BY 'TempusServa';&lt;br /&gt;
* GRANT ALL PRIVILEGES ON *.* TO 'tsinstall'@'*' WITH GRANT OPTION;&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7252</id>
		<title>JavaScript functions v1.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=JavaScript_functions_v1.0&amp;diff=7252"/>
		<updated>2025-02-25T11:45:00Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Value lookups */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;amp;nbsp;&lt;br /&gt;
= Code placement =&lt;br /&gt;
The following places can contain JS code&lt;br /&gt;
* Entity header&lt;br /&gt;
* Entity status&lt;br /&gt;
* JavaScript field&lt;br /&gt;
&lt;br /&gt;
Additionally HTML with inline script can be placed in&lt;br /&gt;
* Wrapper&lt;br /&gt;
* Template&lt;br /&gt;
&lt;br /&gt;
Finally expressions can be evaluated using&lt;br /&gt;
* Entity field dependency&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
= Builtin functions =&lt;br /&gt;
The following functions are only available for single item views (edit or show).&lt;br /&gt;
&lt;br /&gt;
== Get and set values ==&lt;br /&gt;
Display values are handled using standard getter and setters&lt;br /&gt;
* '''getValue(fieldName) '''&lt;br /&gt;
* '''setValue(fieldName,value) '''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let a = getValue(&amp;quot;NUMBER1&amp;quot;);&lt;br /&gt;
let b = getValue(&amp;quot;NUMBER2&amp;quot;);&lt;br /&gt;
setValue( &amp;quot;RESULT&amp;quot;, (a-b) );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For explicitly getting a value (or ID) use&lt;br /&gt;
* '''getDecimal(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
let recordId = getDecimal(&amp;quot;SELECTRECORD&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Toggling fields (5478+) ==&lt;br /&gt;
Note: Hide functions are NOT intended for denying access to data -it will only be hidden in the frontend, but is still accessible to savvy users.&lt;br /&gt;
&lt;br /&gt;
Fields can be  shown or hidden calling the fieldname&lt;br /&gt;
* '''hideField(fieldName)'''&lt;br /&gt;
* '''showField(fieldName)'''&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;USER&amp;quot;);&lt;br /&gt;
hideField(&amp;quot;StatusID&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Dependent toggling ===&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage&lt;br /&gt;
* '''hideFieldForPageClass(fieldName,className)'''&lt;br /&gt;
* '''showFieldForPageClass(fieldName,className)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on items current status.&lt;br /&gt;
* '''hideFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
* '''showFieldForStatusId(fieldName,statusId)'''&lt;br /&gt;
&lt;br /&gt;
Hiding and showing fields can be made dependent on classes in the TempusServaPage AND items current status.&lt;br /&gt;
* '''hideFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
*'''showFieldForPageClassAndStatusId(fieldName,className,statusId)'''&lt;br /&gt;
&lt;br /&gt;
In case of advanced setup consider &amp;quot;hide for all first and show for some later&amp;quot;.&lt;br /&gt;
In this example NAME should only be displayed for a few status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
hideField(&amp;quot;NAME&amp;quot;);   &lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1234);&lt;br /&gt;
showFieldForStatusId(&amp;quot;NAME&amp;quot;,1235);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Disclaimer ===&lt;br /&gt;
The functions are the equivilant of JQuery &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
$(&amp;quot;#VB_DATA_&amp;quot;+fieldName).parent().parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that fields are expected to be wrapped in TWO layers of html tags for the functions to work&lt;br /&gt;
&lt;br /&gt;
== Toggling status ==&lt;br /&gt;
A convenience method is planned for version 7800. Untill then you can use a Jquery expression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(&amp;quot;#DATA_StatusID option[value='123']&amp;quot;).remove();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Binding to events (6734+)==&lt;br /&gt;
The platform sends out events when a couple of events are performed. Code can be written to bind to these.&lt;br /&gt;
&lt;br /&gt;
===Events=== &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;hide-field&amp;lt;/code&amp;gt;, triggered when the platform hides a field (dependency or hideField-function)&lt;br /&gt;
*&amp;lt;code&amp;gt;show-field&amp;lt;/code&amp;gt;, triggered when the platform shows a field (dependency or showField-function)&lt;br /&gt;
&lt;br /&gt;
===How to bind ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&amp;quot;tr&amp;quot;).bind(&amp;quot;hide-field&amp;quot;, function(e) {&lt;br /&gt;
    // Do stuff..&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Value dependencies==&lt;br /&gt;
Using lookup select boxes you can set up complex dependencies between values. The target field will be filtered when the page loads and on all changes to the filter field(s).&lt;br /&gt;
&lt;br /&gt;
===Single dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterOnChange(fieldNameTarget, fieldNameSource, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [ TargetValue, SourceValue ... ],&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTER&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; and &amp;quot;Dong&amp;quot; will be available to select when  FILTER = &amp;quot;Foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Double dependency===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
lookupValueFilterDoubleOnChange(fieldNameTarget, fieldNameSource1, fieldNameSource2, tripleArrayOfConditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var conditions = [&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Foo&amp;quot;, &amp;quot;Dog&amp;quot;],&lt;br /&gt;
  [&amp;quot;Ding&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Cat&amp;quot;],&lt;br /&gt;
  [&amp;quot;Dong&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Fish&amp;quot;],&lt;br /&gt;
];&lt;br /&gt;
lookupValueFilterDoubleOnChange(&amp;quot;LOOKUP&amp;quot;, &amp;quot;FILTERA&amp;quot;, &amp;quot;FILTERB&amp;quot;, conditions);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above &amp;quot;Ding&amp;quot; will be available to select when either : &lt;br /&gt;
*FILTERA = &amp;quot;Foo&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
*FILTERA = &amp;quot;Bar&amp;quot;  -AND-  FilterB = &amp;quot;Cat&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Value triggers==&lt;br /&gt;
Value triggers will make things happen when a field changes. Multiple triggers can be assigned to the same field.&lt;br /&gt;
&lt;br /&gt;
*'''setValueOnChange(sourceName,targetName,targetValue)'''&lt;br /&gt;
* '''setValueOnSetValue(sourceName,sourceValue,targetName,targetValue)'''&lt;br /&gt;
&lt;br /&gt;
Sets the value if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
setValueOnChange(&amp;quot;CATEGORY&amp;quot;,&amp;quot;Silver&amp;quot;,&amp;quot;StatusID&amp;quot;,&amp;quot;Customer changed&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''warningOnChange(sourceName,message)'''&lt;br /&gt;
*'''warningOnSetValue(sourceName,sourceValue,message)'''&lt;br /&gt;
&lt;br /&gt;
Display a warning to a user if another field is changed. Optionally only if a ceratain value is selected (sourceValue) &lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Value lookups==&lt;br /&gt;
Value lookups will copy values from other records to the current one. The normal usecase is records referring other records via parent references.&lt;br /&gt;
&lt;br /&gt;
*'''getValueFromLookup(SourceSagID,SourceDataID,FieldNameSource)'''&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookup(SourceSagID,SourceDataID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will &lt;br /&gt;
#Make a call to ?SagID=''[SagID]''&amp;amp;DataID=''[DataID]''&amp;amp;command=show&lt;br /&gt;
#Pickup the value in the page at #VB_DATA_''[FieldNameSource]''&lt;br /&gt;
#Insert the value in the local field ''FieldNameTarget''&lt;br /&gt;
&lt;br /&gt;
The DataID on the remote record can be picked up automatically by specifying FieldNameTrigger. Note this will only work as long as the trigger field is in editable and the value is changed.&lt;br /&gt;
&lt;br /&gt;
*'''setValueFromLookupTriggered(FieldNameTrigger,SourceSagID,FieldNameSource,FieldNameTarget)'''&lt;br /&gt;
&lt;br /&gt;
The function will  &lt;br /&gt;
#E´xtract the DataID form the field ''FieldNameTrigger''&lt;br /&gt;
# Same as above&lt;br /&gt;
&lt;br /&gt;
== Named queries ==&lt;br /&gt;
You can add peprared statements configurations and make paramterized class to them&lt;br /&gt;
&lt;br /&gt;
*'''lookupNamedQuery(query,value)'''&lt;br /&gt;
&lt;br /&gt;
The query must be stored under the name: &amp;quot;NamedQueryLookup&amp;quot; + query&lt;br /&gt;
&lt;br /&gt;
The value will be inserted into the ? parameter an escaped properly&lt;br /&gt;
&lt;br /&gt;
  SELECT CVR FROM data_company WHERE NAME = ?&lt;br /&gt;
&lt;br /&gt;
If call is made from an entity the Query will be stored in either&lt;br /&gt;
* Entity configuration&lt;br /&gt;
* System configuration&lt;br /&gt;
&lt;br /&gt;
==Inspect command and users==&lt;br /&gt;
The currect command can be examined using&lt;br /&gt;
*'''isCommandNew()'''&lt;br /&gt;
*'''isCommandEdit()'''&lt;br /&gt;
*'''isCommandList()'''&lt;br /&gt;
&lt;br /&gt;
Note that commands are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User types can be determined using&lt;br /&gt;
&lt;br /&gt;
* '''isUserAdmin()'''&lt;br /&gt;
*'''isUserExternal()'''&lt;br /&gt;
*'''isUserNormal()'''&lt;br /&gt;
* '''isUserExclusive()''' (from version 6248)&lt;br /&gt;
&lt;br /&gt;
Note that special roles are allways added as a class to the #TempusServaPage element&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;div id=&amp;quot;TempusServaPage&amp;quot; class=&amp;quot;TempusServaPage IsAdministrator listCommand da_DK&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows for custom CSS for special roles&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   .IsAdministrator h1 { color: red; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Other functions==&lt;br /&gt;
&lt;br /&gt;
=== selectSingleOption(fieldName) ===&lt;br /&gt;
Will set a value if only one option is avaiable in a select box.&lt;br /&gt;
&lt;br /&gt;
=== warnDateAfterOtherDate( dateA, dateZ, message ) ===&lt;br /&gt;
Alerts the user via a popup, if two dates are not after each other. Both date changes triggers the test.&lt;br /&gt;
&lt;br /&gt;
=== disableErrorCountInTitle() and enableErrorCountInTitle() (6734+) ===&lt;br /&gt;
Will disable/enable displaying of numbers of errors i the page-title. Default is enabled&lt;br /&gt;
&lt;br /&gt;
=== changeFieldToShow(fieldName) ===&lt;br /&gt;
Remove input and select boxes and replace them with the value in the field&lt;br /&gt;
&lt;br /&gt;
=== showMoreTableRows(fieldName,rowsShown,buttonLabel) ===&lt;br /&gt;
Makes a nested table shorter by hiding lines &amp;gt; rowsShown. Hidden rows can be shown with the button below the table.&lt;br /&gt;
&lt;br /&gt;
=Control variables=&lt;br /&gt;
TS uses a number of special variables to control the behavior of the frontend. These variables can be changed anywhere.&lt;br /&gt;
&lt;br /&gt;
===Opening new windows===&lt;br /&gt;
Window default sizes are controlled by the following variables&lt;br /&gt;
*'''tsOpenWindowHeight''' = 680;&lt;br /&gt;
*'''tsOpenWindowWidth'''  = 820;&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===Dependency hiding fields ===&lt;br /&gt;
'''hideTableRowsForElements''' is by default true. &lt;br /&gt;
&lt;br /&gt;
Set to false if template structure is only in a single level.&lt;br /&gt;
*true: Hide two parent nodes when hiding fields&lt;br /&gt;
*false: Hide single parent node when hiding fields&lt;br /&gt;
&lt;br /&gt;
Example of 2 level template (default)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&lt;br /&gt;
    &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example of 1 level template (special cases)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
  &amp;lt;input ..&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
=Other sources=&lt;br /&gt;
&lt;br /&gt;
*[[JQUERY / SCRIPT CHEATSHEET| Readonly radiobuttons, copy text in field, build selectbox from service ...]]&lt;br /&gt;
*[[HACKING DEPENDENT VALUES| Handling dependent lookup values (showing all elements etc.)]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7243</id>
		<title>Continous delivery</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7243"/>
		<updated>2025-01-22T15:44:26Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Netbeans */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=== Source code ===&lt;br /&gt;
&lt;br /&gt;
==== Subversion ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== NPM manager ====&lt;br /&gt;
In order to have some of the larger JS components running (chartJs, editor etc) NPM is required&lt;br /&gt;
&lt;br /&gt;
# [https://nodejs.org/en/download Install node.js]&lt;br /&gt;
# From command promp&lt;br /&gt;
#* winget install Schniz.fnm&lt;br /&gt;
#* fnm install 22&lt;br /&gt;
#* cd &amp;lt;svnroot&amp;gt;''\sfwServlets\web''&lt;br /&gt;
#* npm i&lt;br /&gt;
&lt;br /&gt;
Step 2.3 + 2.4 must be repeated for all changes to th JSON manifest&lt;br /&gt;
&lt;br /&gt;
=== Build and test ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Distribution ===&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7242</id>
		<title>Continous delivery</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7242"/>
		<updated>2025-01-22T15:40:36Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Source code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=== Source code ===&lt;br /&gt;
&lt;br /&gt;
==== Subversion ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Netbeans ====&lt;br /&gt;
Increase default memory settings &lt;br /&gt;
&lt;br /&gt;
# Edit: &amp;lt;netbeans&amp;gt;\etc\netbeans.conf &lt;br /&gt;
# Change memory minimum settings&lt;br /&gt;
&lt;br /&gt;
  -J-Xms4g&lt;br /&gt;
&lt;br /&gt;
==== NPM manager ====&lt;br /&gt;
In order to have some of the larger JS components running (chartJs, editor etc) NPM is required&lt;br /&gt;
&lt;br /&gt;
# [https://nodejs.org/en/download Install node.js]&lt;br /&gt;
# From command promp&lt;br /&gt;
#* winget install Schniz.fnm&lt;br /&gt;
#* fnm install 22&lt;br /&gt;
#* cd &amp;lt;svnroot&amp;gt;''\sfwServlets\web''&lt;br /&gt;
#* npm i&lt;br /&gt;
&lt;br /&gt;
Step 2.3 + 2.4 must be repeated for all changes to th JSON manifest&lt;br /&gt;
&lt;br /&gt;
=== Build and test ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Distribution ===&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7241</id>
		<title>Continous delivery</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7241"/>
		<updated>2025-01-22T14:54:11Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* NPM manager */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=== Source code ===&lt;br /&gt;
&lt;br /&gt;
==== Subversion ====&lt;br /&gt;
&lt;br /&gt;
==== NPM manager ====&lt;br /&gt;
In order to have some of the larger JS components running (chartJs, editor etc) NPM is required&lt;br /&gt;
&lt;br /&gt;
# [https://nodejs.org/en/download Install node.js]&lt;br /&gt;
# From command promp&lt;br /&gt;
#* winget install Schniz.fnm&lt;br /&gt;
#* fnm install 22&lt;br /&gt;
#* cd &amp;lt;svnroot&amp;gt;''\sfwServlets\web''&lt;br /&gt;
#* npm i&lt;br /&gt;
&lt;br /&gt;
Step 2.3 + 2.4 must be repeated for all changes to th JSON manifest&lt;br /&gt;
&lt;br /&gt;
=== Build and test ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Distribution ===&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7240</id>
		<title>Continous delivery</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7240"/>
		<updated>2025-01-22T14:53:03Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* NPM manager */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=== Source code ===&lt;br /&gt;
&lt;br /&gt;
==== Subversion ====&lt;br /&gt;
&lt;br /&gt;
==== NPM manager ====&lt;br /&gt;
&lt;br /&gt;
# [https://nodejs.org/en/download Install node.js]&lt;br /&gt;
# From command promp&lt;br /&gt;
#* winget install Schniz.fnm&lt;br /&gt;
#* fnm install 22&lt;br /&gt;
#* cd &amp;lt;svnroot&amp;gt;''\sfwServlets\web''&lt;br /&gt;
#* npm i&lt;br /&gt;
&lt;br /&gt;
Step 2.3 + 2.4 must be repeated for all changes to th JSON manifest&lt;br /&gt;
&lt;br /&gt;
=== Build and test ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Distribution ===&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7239</id>
		<title>Continous delivery</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7239"/>
		<updated>2025-01-22T14:52:54Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* NPM manager */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=== Source code ===&lt;br /&gt;
&lt;br /&gt;
==== Subversion ====&lt;br /&gt;
&lt;br /&gt;
==== NPM manager ====&lt;br /&gt;
&lt;br /&gt;
# [https://nodejs.org/en/download|Install node.js]&lt;br /&gt;
# From command promp&lt;br /&gt;
#* winget install Schniz.fnm&lt;br /&gt;
#* fnm install 22&lt;br /&gt;
#* cd &amp;lt;svnroot&amp;gt;''\sfwServlets\web''&lt;br /&gt;
#* npm i&lt;br /&gt;
&lt;br /&gt;
Step 2.3 + 2.4 must be repeated for all changes to th JSON manifest&lt;br /&gt;
&lt;br /&gt;
=== Build and test ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Distribution ===&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7238</id>
		<title>Continous delivery</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7238"/>
		<updated>2025-01-22T14:52:43Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* NPM manager */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=== Source code ===&lt;br /&gt;
&lt;br /&gt;
==== Subversion ====&lt;br /&gt;
&lt;br /&gt;
==== NPM manager ====&lt;br /&gt;
&lt;br /&gt;
# [[https://nodejs.org/en/download|Install node.js]]&lt;br /&gt;
# From command promp&lt;br /&gt;
#* winget install Schniz.fnm&lt;br /&gt;
#* fnm install 22&lt;br /&gt;
#* cd &amp;lt;svnroot&amp;gt;''\sfwServlets\web''&lt;br /&gt;
#* npm i&lt;br /&gt;
&lt;br /&gt;
Step 2.3 + 2.4 must be repeated for all changes to th JSON manifest&lt;br /&gt;
&lt;br /&gt;
=== Build and test ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Distribution ===&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7237</id>
		<title>Continous delivery</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=Continous_delivery&amp;diff=7237"/>
		<updated>2025-01-22T14:52:21Z</updated>

		<summary type="html">&lt;p&gt;Kpe: Created page with &amp;quot; === Source code ===  ==== Subversion ====  ==== NPM manager ====  # https://nodejs.org/en/download # From command promp #* winget install Schniz.fnm #* fnm install 22 #* cd &amp;lt;svnroot&amp;gt;''\sfwServlets\web'' #* npm i  Step 2.3 + 2.4 must be repeated for all changes to th JSON manifest  === Build and test ===    === Distribution ===&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=== Source code ===&lt;br /&gt;
&lt;br /&gt;
==== Subversion ====&lt;br /&gt;
&lt;br /&gt;
==== NPM manager ====&lt;br /&gt;
&lt;br /&gt;
# [[Install node.js|https://nodejs.org/en/download]]&lt;br /&gt;
# From command promp&lt;br /&gt;
#* winget install Schniz.fnm&lt;br /&gt;
#* fnm install 22&lt;br /&gt;
#* cd &amp;lt;svnroot&amp;gt;''\sfwServlets\web''&lt;br /&gt;
#* npm i&lt;br /&gt;
&lt;br /&gt;
Step 2.3 + 2.4 must be repeated for all changes to th JSON manifest&lt;br /&gt;
&lt;br /&gt;
=== Build and test ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Distribution ===&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=TS_NoCode_online_documentation&amp;diff=7236</id>
		<title>TS NoCode online documentation</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=TS_NoCode_online_documentation&amp;diff=7236"/>
		<updated>2025-01-22T14:46:57Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Training and certification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the Tempus Serva support page.&lt;br /&gt;
&lt;br /&gt;
On this site you will find the documentation to aid you in your development of safe and flexible solutions.&lt;br /&gt;
&lt;br /&gt;
== Insight and ressources ==&lt;br /&gt;
{|&lt;br /&gt;
&lt;br /&gt;
| '''[[Startup FAQ|Getting started]]'''&lt;br /&gt;
| Frequently asked questions during startup&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| '''[[Features|Platform features]]'''&lt;br /&gt;
|Modules and features in the platform&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  '''[[Security_setup|Security setup]]'''&lt;br /&gt;
| Security and compliance features in the platform&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| '''[[Applications|Application overview]]'''&lt;br /&gt;
| Overview of common uses of the platform&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
| '''[[Guides and tutorials]]'''&lt;br /&gt;
| Step by step guides to developers&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
| '''[[Related materials]]'''&lt;br /&gt;
| External ressources and related materials&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Technical reference ==&lt;br /&gt;
{|&lt;br /&gt;
 &lt;br /&gt;
|  '''[[API v1.0|Java API (v1)]]'''&lt;br /&gt;
| Backend API for building new codeunits&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|  '''[[JavaScript functions v1.0|JavaScript functions]]'''&lt;br /&gt;
| Frontend API for tweaking interface behavior&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|  '''[[Integration/REST|REST interface]]'''&lt;br /&gt;
| Using built-in solution webservices&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|  '''[[Field type reference]]'''&lt;br /&gt;
| Documentation for all data model building blocks (content types)&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|  '''[[Policy reference]]'''&lt;br /&gt;
| Documentation for shared server configuration options&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|  '''[[Command reference]]'''&lt;br /&gt;
| Overview of commands and main functionality &lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|  '''[[Codeunit reference]]'''&lt;br /&gt;
| Reference for common funtionality extensions &lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|  '''[[Service|Scheduled services]]'''&lt;br /&gt;
| Scheduled services tools&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|  '''[[Integration|Integration services]]'''&lt;br /&gt;
| System integration options including REST services&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|  '''[[Command line tools]]'''&lt;br /&gt;
| Tools for maintaining your UNIX platform&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|  '''[[Server maintenence]]'''&lt;br /&gt;
| Tips for hosting TS servers&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
| '''[[Known issues]]'''&lt;br /&gt;
| Behaviour per design, issues and system warnings&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Application support ==&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
&lt;br /&gt;
|  '''[[Basic setup]]'''&lt;br /&gt;
| Basic customization&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|  '''[[TalentPiper]]'''&lt;br /&gt;
| Recruitment software&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|  '''[[Whistleblower]]'''&lt;br /&gt;
| Multitenant solution for whistleblowing&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|  '''[[Intect Flow]]'''&lt;br /&gt;
| Multicompany salary management&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|  '''[[COMPASS]]'''&lt;br /&gt;
| IT governance&lt;br /&gt;
|- &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Training and certification ==&lt;br /&gt;
[https://www.tempusserva.dk/training/ Training overview]&lt;br /&gt;
&lt;br /&gt;
[[Course notes for today]]&lt;br /&gt;
&lt;br /&gt;
[[Coding standards]]&lt;br /&gt;
&lt;br /&gt;
[[Continous delivery]]&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=JQuery_/_script_cheatsheet&amp;diff=7234</id>
		<title>JQuery / script cheatsheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=JQuery_/_script_cheatsheet&amp;diff=7234"/>
		<updated>2025-01-17T11:58:06Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Navigation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=== Navigation ===&lt;br /&gt;
&lt;br /&gt;
==== Redirecting non administrators away from list views ====&lt;br /&gt;
&lt;br /&gt;
  var params =  window.location.href.split(&amp;quot;?&amp;quot;)[1];&lt;br /&gt;
  if( params == &amp;quot;SagID=251&amp;amp;command=list&amp;quot; ) {&lt;br /&gt;
    if( ! $( &amp;quot;#TempusServaPage&amp;quot; ).hasClass( &amp;quot;IsAdministrator&amp;quot; ) ) {&lt;br /&gt;
      console.log(&amp;quot;redirecting to main from list&amp;quot;);&lt;br /&gt;
      window.location.href = &amp;quot;main&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
==== Prevent edit as default command from lists ====&lt;br /&gt;
&lt;br /&gt;
  $(&amp;quot;.tableList a&amp;quot;).each(function() {&lt;br /&gt;
    url = $(this).attr(&amp;quot;href&amp;quot;).replace(&amp;quot;=edit&amp;quot;,&amp;quot;=show&amp;quot;);&lt;br /&gt;
    $(this).attr(&amp;quot;href&amp;quot;,url);&lt;br /&gt;
  });&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Files ===&lt;br /&gt;
&lt;br /&gt;
==== Make all file links WebDAV enabled ====&lt;br /&gt;
&lt;br /&gt;
  $().ready( function() {&lt;br /&gt;
    $(&amp;quot;.webdavFile&amp;quot;).each( function() {&lt;br /&gt;
       $(this).next().attr(&amp;quot;href&amp;quot;, $(this).attr(&amp;quot;href&amp;quot;) );&lt;br /&gt;
    });&lt;br /&gt;
  });&lt;br /&gt;
&lt;br /&gt;
=== Input manipulation ===&lt;br /&gt;
&lt;br /&gt;
==== Building multiselect values from existing services ====&lt;br /&gt;
In the following example the field TERRITORY has autocomplete wuth Country values. Output format example: &amp;quot;Denmark, Finland, Sweden&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  function split( val ) {&lt;br /&gt;
     return val.split( /,\s*/ );&lt;br /&gt;
  }&lt;br /&gt;
  function extractLast( term ) {&lt;br /&gt;
    return split( term ).pop();&lt;br /&gt;
  }&lt;br /&gt;
  $(function() {$(&amp;quot;#DATA_TERRITORY&amp;quot;).autocomplete({&lt;br /&gt;
        source: function( request, response ) {&lt;br /&gt;
          $.getJSON( &amp;quot;autocomplete?type=dk.p2e.blanket.form.fields.ajax.FieldAjaxCountry&amp;amp;subtype=0&amp;quot;, {&lt;br /&gt;
            term: extractLast( request.term )&lt;br /&gt;
          }, response );&lt;br /&gt;
        },&lt;br /&gt;
       autoFocus: true, &lt;br /&gt;
       min_length: 2, &lt;br /&gt;
       delay: 300, &lt;br /&gt;
        search: function() {&lt;br /&gt;
          // custom minLength&lt;br /&gt;
          var term = extractLast( this.value );&lt;br /&gt;
          if ( term.length &amp;lt; 2 ) {&lt;br /&gt;
            return false;&lt;br /&gt;
          }&lt;br /&gt;
        },&lt;br /&gt;
        focus: function() {&lt;br /&gt;
          // prevent value inserted on focus&lt;br /&gt;
          return false;&lt;br /&gt;
        },&lt;br /&gt;
        select: function( event, ui ) {&lt;br /&gt;
          var terms = split( this.value );&lt;br /&gt;
          // remove the current input&lt;br /&gt;
          terms.pop();&lt;br /&gt;
          // add the selected item&lt;br /&gt;
          terms.push( ui.item.value );&lt;br /&gt;
          // add placeholder to get the comma-and-space at the end&lt;br /&gt;
          terms.push( &amp;quot;&amp;quot; );&lt;br /&gt;
          this.value = terms.join( &amp;quot;, &amp;quot; );&lt;br /&gt;
          return false;&lt;br /&gt;
        }&lt;br /&gt;
  });});&lt;br /&gt;
&lt;br /&gt;
==== Making radiobuttons unselectable ====&lt;br /&gt;
Clicking on a radiobutton a second type will remove the selection&lt;br /&gt;
&lt;br /&gt;
  $(&amp;quot;input[type=radio]&amp;quot;).click( function() {&lt;br /&gt;
   if( $(this).attr(&amp;quot;checked&amp;quot;) == 'checked' )&lt;br /&gt;
      $(this).removeAttr(&amp;quot;checked&amp;quot;).button(&amp;quot;refresh&amp;quot;);&lt;br /&gt;
  else&lt;br /&gt;
      $(this).attr(&amp;quot;checked&amp;quot;,true).button(&amp;quot;refresh&amp;quot;);     &lt;br /&gt;
  });&lt;br /&gt;
&lt;br /&gt;
==== Transform text input to selectbox ====&lt;br /&gt;
Include the following function&lt;br /&gt;
&lt;br /&gt;
  function transformToSelectField( fieldName, valueList) {&lt;br /&gt;
    var select = &amp;quot;&amp;lt;select class='form-control' id='DATA_&amp;quot; + fieldName + &amp;quot;' name='DATA_&amp;quot; + fieldName + &amp;quot;' tabindex='2'&amp;gt;&amp;quot;;&lt;br /&gt;
    var optionsList = valueList.split(&amp;quot; &amp;quot;); &lt;br /&gt;
    for (var i = 0; i &amp;lt; optionsList.length; i++) { &lt;br /&gt;
     var isSelected = ( getValue(fieldName) == optionsList[i] ) ? &amp;quot; selected &amp;quot; : &amp;quot;&amp;quot;;&lt;br /&gt;
     select += &amp;quot;&amp;lt;option &amp;quot; + isSelected + &amp;quot; value='&amp;quot; + optionsList[i] + &amp;quot;'&amp;gt;&amp;quot; + optionsList[i] + &amp;quot;&amp;lt;/option&amp;gt;&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    select += &amp;quot;&amp;lt;/select&amp;gt;&amp;quot;;&lt;br /&gt;
    console.log( select );&lt;br /&gt;
    $(&amp;quot;#DATA_&amp;quot; + fieldName).replaceWith( select );&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Example usage &lt;br /&gt;
&lt;br /&gt;
   transformToSelectField( &amp;quot;NAME&amp;quot;, &amp;quot;Alice Bob&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Copy / paste ===&lt;br /&gt;
&lt;br /&gt;
==== Selecting text for easy copying ====&lt;br /&gt;
&lt;br /&gt;
  //Get Exising Select Options    &lt;br /&gt;
  $('form#product select').each(function(i, select){&lt;br /&gt;
     var $select = $(select);&lt;br /&gt;
     $select.find('option').each(function(j, option){&lt;br /&gt;
        var $option = $(option);&lt;br /&gt;
        // Create a radio:&lt;br /&gt;
        var $radio = $('&amp;lt;input type=&amp;quot;radio&amp;quot; /&amp;gt;');&lt;br /&gt;
        // Set name and value:&lt;br /&gt;
        $radio.attr('name', $select.attr('name')).attr('value', $option.val());&lt;br /&gt;
        // Set checked if the option was selected&lt;br /&gt;
        if ($option.attr('selected')) $radio.attr('checked', 'checked');&lt;br /&gt;
        // Insert radio before select box:&lt;br /&gt;
        $select.before($radio);&lt;br /&gt;
        // Insert a label:&lt;br /&gt;
        $select.before(&lt;br /&gt;
          $(&amp;quot;&amp;lt;label /&amp;gt;&amp;quot;).attr('for', $select.attr('name')).text($option.text())&lt;br /&gt;
        );&lt;br /&gt;
        // Insert a &amp;lt;br /&amp;gt;:&lt;br /&gt;
        $select.before(&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;);&lt;br /&gt;
     });&lt;br /&gt;
     $select.remove();&lt;br /&gt;
  });&lt;br /&gt;
&lt;br /&gt;
[https://stackoverflow.com/questions/2029267/jquery-convert-select-to-radio-buttons credit]&lt;br /&gt;
&lt;br /&gt;
==== Selecting text for easy copying ====&lt;br /&gt;
&lt;br /&gt;
  var textNode = document.getElementById('IdOfNodeToBeSelected');&lt;br /&gt;
  if (document.selection) {&lt;br /&gt;
    var range = document.body.createTextRange();&lt;br /&gt;
    range.moveToElementText(textNode);&lt;br /&gt;
    range.select();&lt;br /&gt;
  } else if (window.getSelection) {&lt;br /&gt;
    var selection = window.getSelection();&lt;br /&gt;
    var range = document.createRange();&lt;br /&gt;
    range.selectNodeContents(textNode);&lt;br /&gt;
    selection.removeAllRanges();&lt;br /&gt;
    selection.addRange(range);	&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== AJAX lookups ===&lt;br /&gt;
&lt;br /&gt;
==== Address lookup in Denmark ====&lt;br /&gt;
In custom header&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;script src='script/dawa-autocomplete.js' &amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In custom script&lt;br /&gt;
&lt;br /&gt;
  $(&amp;quot;#DATA_ADRESSE&amp;quot;).dawaautocomplete({ adgangsadresserOnly: true, baseUrl: 'https://dawa.aws.dk/' });&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=EC2_server_recovery&amp;diff=7232</id>
		<title>EC2 server recovery</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=EC2_server_recovery&amp;diff=7232"/>
		<updated>2025-01-10T00:15:49Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* No SSL connections possible */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=== Recovery procedure without database backup ===&lt;br /&gt;
&lt;br /&gt;
==== Changes in AWS ==== &lt;br /&gt;
# Make a snapshot of the running server&lt;br /&gt;
# Make a volume from the snap shot&lt;br /&gt;
# Name the volume: RESTORE COPY&lt;br /&gt;
# Create a NEW server&lt;br /&gt;
# Attatch the RESTORE COPY to NEW server on /dev/sdf&lt;br /&gt;
&lt;br /&gt;
==== Connect to new server ==== &lt;br /&gt;
# Install TS client tools&lt;br /&gt;
# ts quick-install&lt;br /&gt;
# ts stop-webserver&lt;br /&gt;
# ts stop-database&lt;br /&gt;
# mkdir /mnt/oldroot&lt;br /&gt;
# sudo mount /dev/nvme1n1p1 /mnt/oldroot&lt;br /&gt;
# sudo rm -r /var/lib/mysql&lt;br /&gt;
# sudo cp -r /mnt/oldroot/var/lib/mysql /var/lib&lt;br /&gt;
# ts start-database&lt;br /&gt;
# mysql -uroot -p -e &amp;quot;UPDATE applive.systempolicy SET PolicyValue='false' WHERE PolicyName LIKE 'securitySsl%'&amp;quot;&lt;br /&gt;
# sudo rm -r /mnt/sda/*&lt;br /&gt;
# sudo cp -r /mnt/oldroot/usr/tempusserva/sda/* /mnt/sda/&lt;br /&gt;
# sudo chmod 777 -R /mnt/sda/files&lt;br /&gt;
# sudo cp /mnt/oldroot/usr/share/tomcat8/conf/Catalina/localhost/* /usr/share/tomcat8/conf/Catalina/localhost&lt;br /&gt;
# ts start-webserver&lt;br /&gt;
# Ensure server is running&lt;br /&gt;
&lt;br /&gt;
==== Changes in AWS ==== &lt;br /&gt;
# Stop NEW server&lt;br /&gt;
# Detatch RESTORE COPY&lt;br /&gt;
# Stop OLD server&lt;br /&gt;
# Deassociate IP from OLD server&lt;br /&gt;
# Associate IP to NEW server&lt;br /&gt;
# Start NEW server&lt;br /&gt;
&lt;br /&gt;
==== Connect to new server ==== &lt;br /&gt;
# ts install-ssl&lt;br /&gt;
# mysql -uroot -p -e &amp;quot;UPDATE applive.systempolicy SET PolicyValue='true' WHERE PolicyName LIKE 'securitySsl%'&amp;quot;&lt;br /&gt;
# ts restart-webserver&lt;br /&gt;
&lt;br /&gt;
==== Steps is using S3 filesystem ==== &lt;br /&gt;
# [[Server_maintenence#Moving_files_to_S3_storage]]&lt;br /&gt;
#* Step: Add IAM role to server&lt;br /&gt;
#* Step: Install the mountpoint&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
	<entry>
		<id>https://wiki.tsnocode.dev/index.php?title=EC2_server_recovery&amp;diff=7231</id>
		<title>EC2 server recovery</title>
		<link rel="alternate" type="text/html" href="https://wiki.tsnocode.dev/index.php?title=EC2_server_recovery&amp;diff=7231"/>
		<updated>2025-01-10T00:14:19Z</updated>

		<summary type="html">&lt;p&gt;Kpe: /* Connect to new server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=== No SSL connections possible ===&lt;br /&gt;
&lt;br /&gt;
==== Changes in AWS ==== &lt;br /&gt;
# Make a snapshot of the running server&lt;br /&gt;
# Make a volume from the snap shot&lt;br /&gt;
# Name the volume: RESTORE COPY&lt;br /&gt;
# Create a NEW server&lt;br /&gt;
# Attatch the RESTORE COPY to NEW server on /dev/sdf&lt;br /&gt;
&lt;br /&gt;
==== Connect to new server ==== &lt;br /&gt;
# Install TS client tools&lt;br /&gt;
# ts quick-install&lt;br /&gt;
# ts stop-webserver&lt;br /&gt;
# ts stop-database&lt;br /&gt;
# mkdir /mnt/oldroot&lt;br /&gt;
# sudo mount /dev/nvme1n1p1 /mnt/oldroot&lt;br /&gt;
# sudo rm -r /var/lib/mysql&lt;br /&gt;
# sudo cp -r /mnt/oldroot/var/lib/mysql /var/lib&lt;br /&gt;
# ts start-database&lt;br /&gt;
# mysql -uroot -p -e &amp;quot;UPDATE applive.systempolicy SET PolicyValue='false' WHERE PolicyName LIKE 'securitySsl%'&amp;quot;&lt;br /&gt;
# sudo rm -r /mnt/sda/*&lt;br /&gt;
# sudo cp -r /mnt/oldroot/usr/tempusserva/sda/* /mnt/sda/&lt;br /&gt;
# sudo chmod 777 -R /mnt/sda/files&lt;br /&gt;
# sudo cp /mnt/oldroot/usr/share/tomcat8/conf/Catalina/localhost/* /usr/share/tomcat8/conf/Catalina/localhost&lt;br /&gt;
# ts start-webserver&lt;br /&gt;
# Ensure server is running&lt;br /&gt;
&lt;br /&gt;
==== Changes in AWS ==== &lt;br /&gt;
# Stop NEW server&lt;br /&gt;
# Detatch RESTORE COPY&lt;br /&gt;
# Stop OLD server&lt;br /&gt;
# Deassociate IP from OLD server&lt;br /&gt;
# Associate IP to NEW server&lt;br /&gt;
# Start NEW server&lt;br /&gt;
&lt;br /&gt;
==== Connect to new server ==== &lt;br /&gt;
# ts install-ssl&lt;br /&gt;
# mysql -uroot -p -e &amp;quot;UPDATE applive.systempolicy SET PolicyValue='true' WHERE PolicyName LIKE 'securitySsl%'&amp;quot;&lt;br /&gt;
# ts restart-webserver&lt;br /&gt;
&lt;br /&gt;
==== Steps is using S3 filesystem ==== &lt;br /&gt;
# [[Server_maintenence#Moving_files_to_S3_storage]]&lt;br /&gt;
#* Step: Add IAM role to server&lt;br /&gt;
#* Step: Install the mountpoint&lt;/div&gt;</summary>
		<author><name>Kpe</name></author>
	</entry>
</feed>