Tutorial on global variables and local variables in ScriptCase

Source: Internet
Author: User
Global and local variables in ScriptCase. When creating an application, you sometimes need to use global variables. for example, you can save the user name after logging on to the application, and then use it on every page (for example, when using a set of applications, you sometimes need to use global variables. for example, after logging on successfully, you can save the user name and use it on every page (for example, use the user name to filter data that can be viewed by the user ). At this time, global variables are required.


The global variable of Scriptcase is marked as [varname].


For example, when you log on, you can save the user name you entered to [usr_login] After the verification is passed. it can be used in any application in the system, whether in the code, or in the configuration function.


To display only the data of the current user in a list, you can configure the SQL statement as follows:


SELECT filename1, fieldname2 FROM table1 WHERE login = '[usr_login]'


The system reads the global variable. if logon fails, the system prompts you to log on again.


If you want to define the variables used in the current function, you can simply use $ varname.


For fields, {fieldname} can be used for access. For example, if you want to save the password you set to the database with MD5 encryption, you can write it as follows:

{Password} = md5 ({password });


Another application of braces is the translation of multiple languages. as long as the language tag is defined, it can be used directly in the code, for example:


{Errormessage }={ lang_message_inserterror };


You can set the characters corresponding to different languages in "language settings-regional language" so that the system can support multiple languages.

Using (for example, using...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.