Difference between revisions of "Transaction Variables"

From SmartWiki
Jump to: navigation, search
 
m (Parent Object)
 
(39 intermediate revisions by 5 users not shown)
Line 1: Line 1:
==How to display the Transaction types==
+
==Variables==
 +
 
 +
* Subject: @subject@<br>
 +
* Status: @status@<br>
 +
* Details: @Details@<br>
 +
* Start Date: @startdate@<br>
 +
* End Date: @enddate@<br>
 +
* Transaction ID: @transid@<br>
 +
* Transaction Type Name: @transtype@<br>
 +
* Transaction Type ID: @transtypeid@<br>
 +
* Last Modified: @trsts@  (transaction time-stamp)<br>
 +
* Custom Fields: @''customfieldname''@ (see note below)<br>
  
In order to display a transaction type and its fields use the following example:
 
  
Syntax:
 
<pre>
 
[#(?object=transaction;orderby=fieldname;criteria=typename='')<tr><td>$customfieldid$</td><td>$customfieldid$</td></tr>#]
 
</pre>
 
Example Code:
 
  
  [#(?object=transaction;orderby=tbl_1041842.valuestr desc;criteria=typename='Co-Principal Investigor, Co-Applicant, Additional Author')
+
Transactions are often displayed as a list, which can be done using the following syntax:
<tr><!--~typename~--><td>$1041842$</td><td>$1041843$</td><td>$1041844$</td><td>$1041845$</td></tr>
+
  [#(?object=transaction::orderby=fieldname::criteria=typename="''thistypename''" and statusname="Submitted")<tr><td>~subject~</td><td>$customfieldid$</td></tr>#]
#]
 
  
  
To retrieve all '''Company''' transactions for the company attached to '''Level 1''' (Standard field - Customer):
+
In a list use the variables listed above but replace '''@''' with '''~'''
 +
* '''Exception''': to include [[Custom Fields]] in a list use either '''$customfieldname$''' or '''$customfieldid$'''
 +
* Last Modified Date can be shown in a list of transactions using: '''~date_format(trsts,'%Y-%m-%d %H:%i') as lastmodified~'''
 +
:(Note: The See Also section has an external hyperlink for more DATE_FORMAT specifiers)
  
<pre>
 
@company.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@
 
</pre>
 
  
To retrieve all '''Branch''' transactions for the branch attached to '''Level 1''' (Standard field - Branch):
+
===Parent Object===
 +
On a Company/Account transaction you can display or store the name of the Company the transaction is attached to on the transaction by creating a [[Read Only - System Variable]] or [[Store Value - System Variable]] '''on the transaction''' with the following syntax:
 +
:<font size="3">'''@parent.name@'''</font>
  
<pre>
+
On a Contact transaction you can display or store the name of the contact the transaction is attached to on the transaction using:
@branch.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@
+
:<font size="3">'''@parent.fullname@'''</font>
</pre>
 
  
To retrieve all '''People''' transactions for the [[User|user]] attached to '''Level 1''' (Standard field - Owner):
+
On a UTA L1 transaction you can display or store fields from the level one record the transaction is attached to on the transaction by using the following syntax:
 +
:<font size="3">'''@levelone.fieldname@'''</font>
  
<pre>
+
==Examples==
@owner.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@
+
===Company/Account or Contact/User Transactions===
</pre>
+
To retrieve all transactions associated with a Company or Contact record:
 +
[#(?object=transaction;)<tr><td>Subject:</td><td>~details~</td></tr>#]
  
To retrieve the '''Level 1''' transactions at '''Level 2''':
+
===UTA Transactions===
 +
To retrieve the {{l1}} transactions at {{l2}}:
 +
@parent.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@
  
<pre>
 
@parent.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@
 
</pre>
 
  
 
To retrieve the '''Level 1''' transactions at '''Level 2''' by transaction type:
 
To retrieve the '''Level 1''' transactions at '''Level 2''' by transaction type:
 +
@parent.[#(?object=transaction;criteria=typename='Name of Transaction Type')
 +
<tr><td>~subject</td><td>$customfieldid$</td><td>~customfieldname~</td><td>$customfieldid$</td></tr>
 +
#]@
 +
 +
 +
To count the '''Level 1''' transactions at '''Level 1''':
 +
@trans1.count(trstransid):trstranstype=''transtypeid''@
 +
 +
* '''Where''' transtypeid is the transaction type id of the transaction you wish to count.
 +
 +
 +
To count the '''Level 2''' transactions at '''Level 2''':
 +
@trans2.count(trstransid):trstranstype=''transtypeid''@
 +
 +
 +
To count the '''Level 1''' transactions at '''Level 2''':
 +
@parent.trans1.count(trstransid):trstranstype=''transtypeid''@
 +
 +
 +
Example:
 +
@trans2.count(trstransid):trstranstype=544@
 +
 +
===Contact/Account Transactions from a UTA===
 +
'''Note''': Transactions on '''Companies''' or '''Contacts''' associated with a [[UTA]] can be displayed in web page view. The transaction does not have to be directly associated with the '''Level 1''' item.
 +
  
 +
To retrieve all '''Company''' transactions for the company attached to the '''Customer''' [[Standard Field]] at Level 1:
 +
@company.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@
 +
 +
 +
To retrieve all '''Company''' transactions for the branch attached to the '''Branch''' [[Standard Field]] at Level 1:
 +
@branch.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@
 +
 +
 +
To retrieve all '''People''' transactions for the '''Owner''' of a Level 1:
 +
@owner.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@
 +
 +
 +
 +
Additional Example:
 +
[#(?object=transaction;orderby=tbl_1041842.valuestr desc;criteria=typename='Co-Principal Investigor, Co-Applicant, Additional Author')
 +
<tr><!--~typename~--><td>$1041842$</td><td>$1041843$</td><td>$1041844$</td><td>$1041845$</td></tr>
 +
#]
 +
 +
==Performing Calculations==
 +
 +
You can <u>display</u> a Sum (for example) of the values in a [[Custom Field]] for all transactions associated with a Company/Contact using [[sscalculation]] within either a [[Web Page View]] or [[Custom Field Type: Read Only – System Variables|Read Only - System Variables]] field:
 
<pre>
 
<pre>
@parent.[#(?object=transaction;criteria=typename='Name of Transaction Type')
+
<!--@sscalculation( [#(?object=transaction;)$add this$+#]0)-->
<tr><td>$fieldid$</td><td>$fieldid$</td><td>$fieldid$</td><td>$fieldid$</td></tr>
 
#]@
 
 
</pre>
 
</pre>
  
'''Impact''': Transactions on the '''Company''' and [[User]] objects can now be displayed in a [[UTA]] web page view. The transaction does not have to directly associated with the '''Level 1''' item.
+
* '''Important:''' There <u>must</u> be a space prior to the opening square bracket.
 +
* Also: when summing values don't forget the zero after the closing square bracket. For example, if there are transactions with values of 10, 15 and 20 the statement between the square brackets would be translated as follows:
 +
::''[#(?object=transaction;)$add this$+#]'' &nbsp;&nbsp;&nbsp; becomes    &nbsp;&nbsp;&nbsp;  ''10+15+20+''
 +
:so the 0 at the end ensures that the statement evaluated doesn't end with a plus sign (which will fail).
 +
 
  
 +
'''Note''': You can also use [[sscalculation]] to format the display of dates
  
'''To get the modified date of a transaction use the following:'''
 
  
  ~trsts~ ''or'' ~date_format(trsts,'%Y-%m-%d') as lastmodified~
+
If you want to store the value on the Company/Contact record you should use a [[Calculated Value]] field :
 +
  ( [#(?object=transaction;)$add this$+#]0)
 +
* '''NOTE''': The [[Calculated Value]] will only be updated when the Company/Contact record is saved. '''Not''' whenever a [[Transaction]] is created.
  
 +
==See Also==
 +
* [[sscalculation]]
  
 
[[Category:Transactions]][[Category:Variables]]
 
[[Category:Transactions]][[Category:Variables]]

Latest revision as of 09:33, 15 March 2023

Variables

  • Subject: @subject@
  • Status: @status@
  • Details: @Details@
  • Start Date: @startdate@
  • End Date: @enddate@
  • Transaction ID: @transid@
  • Transaction Type Name: @transtype@
  • Transaction Type ID: @transtypeid@
  • Last Modified: @trsts@ (transaction time-stamp)
  • Custom Fields: @customfieldname@ (see note below)


Transactions are often displayed as a list, which can be done using the following syntax:

[#(?object=transaction::orderby=fieldname::criteria=typename="thistypename" and statusname="Submitted")<tr><td>~subject~</td><td>$customfieldid$</td></tr>#]


In a list use the variables listed above but replace @ with ~

  • Exception: to include Custom Fields in a list use either $customfieldname$ or $customfieldid$
  • Last Modified Date can be shown in a list of transactions using: ~date_format(trsts,'%Y-%m-%d %H:%i') as lastmodified~
(Note: The See Also section has an external hyperlink for more DATE_FORMAT specifiers)


Parent Object

On a Company/Account transaction you can display or store the name of the Company the transaction is attached to on the transaction by creating a Read Only - System Variable or Store Value - System Variable on the transaction with the following syntax:

@parent.name@

On a Contact transaction you can display or store the name of the contact the transaction is attached to on the transaction using:

@parent.fullname@

On a UTA L1 transaction you can display or store fields from the level one record the transaction is attached to on the transaction by using the following syntax:

@levelone.fieldname@

Examples

Company/Account or Contact/User Transactions

To retrieve all transactions associated with a Company or Contact record:

[#(?object=transaction;)<tr><td>Subject:</td><td>~details~</td></tr>#]

UTA Transactions

To retrieve the Level 1 transactions at Level 2:

@parent.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@


To retrieve the Level 1 transactions at Level 2 by transaction type:

@parent.[#(?object=transaction;criteria=typename='Name of Transaction Type')
<tr><td>~subject</td><td>$customfieldid$</td><td>~customfieldname~</td><td>$customfieldid$</td></tr>
#]@


To count the Level 1 transactions at Level 1:

@trans1.count(trstransid):trstranstype=transtypeid@
  • Where transtypeid is the transaction type id of the transaction you wish to count.


To count the Level 2 transactions at Level 2:

@trans2.count(trstransid):trstranstype=transtypeid@


To count the Level 1 transactions at Level 2:

@parent.trans1.count(trstransid):trstranstype=transtypeid@


Example:

@trans2.count(trstransid):trstranstype=544@

Contact/Account Transactions from a UTA

Note: Transactions on Companies or Contacts associated with a UTA can be displayed in web page view. The transaction does not have to be directly associated with the Level 1 item.


To retrieve all Company transactions for the company attached to the Customer Standard Field at Level 1:

@company.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@


To retrieve all Company transactions for the branch attached to the Branch Standard Field at Level 1:

@branch.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@


To retrieve all People transactions for the Owner of a Level 1:

@owner.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@


Additional Example:

[#(?object=transaction;orderby=tbl_1041842.valuestr desc;criteria=typename='Co-Principal Investigor, Co-Applicant, Additional Author')
<tr><td>$1041842$</td><td>$1041843$</td><td>$1041844$</td><td>$1041845$</td></tr>
#]

Performing Calculations

You can display a Sum (for example) of the values in a Custom Field for all transactions associated with a Company/Contact using sscalculation within either a Web Page View or Read Only - System Variables field:

<!--@sscalculation( [#(?object=transaction;)$add this$+#]0)-->
  • Important: There must be a space prior to the opening square bracket.
  • Also: when summing values don't forget the zero after the closing square bracket. For example, if there are transactions with values of 10, 15 and 20 the statement between the square brackets would be translated as follows:
[#(?object=transaction;)$add this$+#]     becomes     10+15+20+
so the 0 at the end ensures that the statement evaluated doesn't end with a plus sign (which will fail).


Note: You can also use sscalculation to format the display of dates


If you want to store the value on the Company/Contact record you should use a Calculated Value field :

( [#(?object=transaction;)$add this$+#]0)

See Also