Yogesh Chauhan's Blog

Two ways we can use colon(:) in Envision Basic

in Envision Basic on December 21, 2021

1. Used as a Concatenation Operator

The syntax is:


expr1 : expr2

The : operator concatenates two expressions. It is same as the CAT operator.

This how you can use : operator and CAT. Both will save “Hey there” in the Str variable.


Str = "Hey " CAT "there"
Str = "Hey " : "there"

2. Used as an Expand-in-Place Directive

The syntax is:


:directoryname filename [USING parameter(s)]:

The “:” directive is used to specify an EXPAND-IN-PLACE insert.

In Envision Basic, there are two ways to insert one block of code into another:

  1. via UniBasic’s native $INSERT command.
  2. via an EXPAND-IN-PLACE insert.

For example, the file “I_GETNBR” in the directory “UT.INSERTS” contains a block of Envision Basic code. You could reference that code within other code either as:


$INSERT I_GETNBR FROM UT.INSERTS

or


:UT.INSERTS I_GETNBR:

The $INSERT statement generally adds just a single line $INSERT statement to the generated source file which helps shrink the process’s generated source file size. That’s why the $INSERT technique is generally preferred.

If you use the colon syntax, it will insert the entire block of code into the generated source code.

The one exception to the rule of “a $INSERT statement adds just one line to a process’s generated source code” occurs when your process is a form and the insert block contains Envision extensions. In that case, the $INSERT statement behaves like an EXPAND-IN-PLACE insert.

Note: Envision extensions are statements that are not native to UniBasic, but are Ellucian-created extensions of UniBasic.

For historical reasons, the $INSERT statement does not exhibit that same exception when used in a batch process. That means $INSERTs used in a batch process are not permitted to contain Envision extensions.

If your insert file does not contain any Envision Basic extensions, then you should always use the $INSERT technique.

However, for historical reasons you may often see such insert files being used as EXPAND-IN-PLACE files.

At one time, UniBasic did not permit nested $INSERT statements. This is no longer the case.

Nested $INSERT statements means having a $INSERT statement in a file that was itself referenced by a $INSERT statement.

So one reason to use EXPAND-IN-PLACE inserts is to reference insert files that contain Envision extensions.

Another reason to use EXPAND-IN-PLACE inserts is that, via the USING keyword, they permit the use of placeholders.

Placeholders allow you to create an insert file with “to be filled in at run-time” pieces. These are defined in the insert file by the $USING line.

Credit: Envision Basic Command Reference


Most Read

#1 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #2 How to add Read More Read Less Button using JavaScript? #3 How to check if radio button is checked or not using JavaScript? #4 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to uninstall Cocoapods from the Mac OS?

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
Create a menu with a curtain falling animation using CSS and JavaScriptCSSLIKE and ILIKE Operators in PostgresPostgresHow to add transparent text on top of an image using CSS?CSSThe ALPHA function in Envision BasicEnvision BasicHow to enable and disable button using JavaScript?JavaScriptLearn to create your skill bar using CSSCSS