Difference between revisions of "System Variables"

From SmartWiki
Jump to: navigation, search
Line 32: Line 32:
 
</pre>
 
</pre>
  
The system will replace @me.langid@ with either 1 or 2 depending if the current user has their primary language set as English or French(Canada).
+
The system will replace @me.langid@ with either 1 or 2 depending if the current user has their primary language set as English or French (Canada). They will pull the relevant System Variable.
Then will pull the relevant [[System Variable]]
 
  
  
 
'''Note:''' Do not use '''@system2.''' variables to populate the "options" for fields such as a [[Combo Box]] or [[Check Boxes]] if you wish to be able to search using those fields. The system will not be able to process the variable when searching from the [[List View]]. If using system2 (with @me.langid@) to process different user languages the [[Custom Field Language Settings]] should be used to obtain the language specific option values.
 
'''Note:''' Do not use '''@system2.''' variables to populate the "options" for fields such as a [[Combo Box]] or [[Check Boxes]] if you wish to be able to search using those fields. The system will not be able to process the variable when searching from the [[List View]]. If using system2 (with @me.langid@) to process different user languages the [[Custom Field Language Settings]] should be used to obtain the language specific option values.
 +
 +
==Setting a System Variable==
 +
 +
# Go to [[Global Settings]]
 +
# Under the [[System Variables and Custom Fields]] heading, click on the hyperlink for System Variables.
 +
# Click on the "New Variable" button and enter details:
 +
:* '''Name''' will be the variable name referenced in the '''@system.''variable name''@''' syntax.
 +
:* '''Description''' is an optional narrative description.
 +
:* '''Value''' will be the value returned by the variable.
 +
 +
If the Value is a date, use the ''yyyy-mm-dd'' date format.
 +
  
  

Revision as of 12:14, 30 September 2013

The System Variables setting on the Global Settings page allows you to create and edit system-wide Custom Fields within your instance. These variables can be referred to from anywhere within SmartSimple using the following syntax:

@system.variable name@


Example: If you have created a System Variable named Tax Rate you would use:

@system.tax rate@


A global System Library can be accessed as system variables. The available values and functions can be found under System Variables on the Global Settings page. The syntax is:

@system.library.variable name@


Example: To return a list of languages from the global library, you would use:

@system.library.language@


System 2

You can also pre-process the variable name to access different system variables based on the context.

For example, if on a Web Page View you have a button that you want to have a different value based on the langid of the user.

  • Name: Open1 Value: Open
  • Name: Open2 Value: Ouvert

And refer to them on the Web Page View as follows

 <input type=button value="@system2.Open@me.langid@@" onclick="doThis()">

The system will replace @me.langid@ with either 1 or 2 depending if the current user has their primary language set as English or French (Canada). They will pull the relevant System Variable.


Note: Do not use @system2. variables to populate the "options" for fields such as a Combo Box or Check Boxes if you wish to be able to search using those fields. The system will not be able to process the variable when searching from the List View. If using system2 (with @me.langid@) to process different user languages the Custom Field Language Settings should be used to obtain the language specific option values.

Setting a System Variable

  1. Go to Global Settings
  2. Under the System Variables and Custom Fields heading, click on the hyperlink for System Variables.
  3. Click on the "New Variable" button and enter details:
  • Name will be the variable name referenced in the @system.variable name@ syntax.
  • Description is an optional narrative description.
  • Value will be the value returned by the variable.
If the Value is a date, use the yyyy-mm-dd date format.


See Also