Other Xbasic Topics
A collection of various topics on Xbasic.
- Building Multi-Tenant Applications - Dynamic Connection Strings
A multi-tenant application is an application that is shared by many different customers. Salesforce.com is a good example of a multi-tenant application. There are typically two different approaches to building a multi-tenant application. These are:
- Change In Way AEX Files are Used in a Web Application
Describes how to alter an application to work without a5w_load_aex(), which is no longer needed.
- Check the logs
The Application Server can record a variety of useful information in different log files. The value of these log files in detecting and troubleshooting any problems is immeasurable. Many times, application users will not report what they presume to be minor errors, or they may not even be aware of something like a missing image which, if present, would enhance the usability or appearance of the application.
- Creating a Login Page
Code examples and a short guide on how to create a login page.
- Declaring a Variable
Before a variable is used either by a script or in an expression, it must be declared. A variable can be declared either explicitly (as a formal declaration in a script, a table, a set, a form, or an application) or implicitly (by assigning it a value for the first time in a script). In general, a variable declaration must specify two things: the name of the variable, and the type of data the variable will contain.
- Functions and Expressions
Functions are pre-defined operators which can be used in an expression to perform an operation. Expressions, which are similar to mathematical equations, are used throughout Alpha Anywhere to specify search criteria, put records in a particular order, link tables in a set, and more.
- How Pages are Rendered
- Making Statements Conditional
The most common and useful conditional statement in the Xbasic language uses the IF ... THEN ... ELSE ... END IF syntax. The statement begins by testing whether an expression is True (evaluates to .T.). If the expression is True, the Application Server executes the statement after the THEN clause. If the expression is False (.F.), the Application Server executes the statement after the ELSE clause. The following example uses the DATE() function to return the current date. It then uses the CDOW() function to determine if the current day is "Saturday".
- How to make User-Defined Functions Available to a Web Application
The Alpha Anywhere HTML Editor, and any code window in Alpha Anywhere, will automatically detect and recognize UDFs (User-Defined Functions) defined in the current database function library.
- Xbasic - OLE Automation - Implementing Callback Event Handlers in Xbasic
This topic discusses how you can write Xbasic code to handle callback events when running OLE automation code.
- Parsing XML Documents with Xbasic
Alpha Anywhere has a powerful XML parser built-in that can be used as an alternative to the Microsoft XML parser. The advantage of the Xbasic XML parser is that it can use all of the powerful string functions in Xbasic. The Microsoft XML parsers are more complex to use because you have to use OLE Automation.
- Passing Variables by Reference
It is possible to pass variables by reference, using the byref keyword. If the receiving function changes the value of the variable, the sending function will see those changes. Assume you have the following function named test().
- Understanding and Using Dot Variables
After you create a pointer variable, you may add to it any number of "child" variables of different types. These are known as dot variables.
- Understanding Data Types
The Xbasic programming language supports 11 types of variables (see Variable Data Types and Scope ). You will find yourself using the following types of variables.
- Understanding the Programming Process
Hopefully, you (the developer of a database application) realize that Web Publishing allows you to create applications without actually programming. The various genies, utilities, and Action Scripting allow you to generate programs by dealing with design issues at a higher level, and letting the Application Server generate and run the necessary programs in the background.
- Using ADO (ActiveX Data Objects) with Xbasic
Looks at connection objects, SQL commands, the recordset object, updating records, inserting records
- Variable Indirection
Variable indirection refers to the situation when you want to manipulate a variable, but the name of the variable that you want to operate on is stored in another variable. The following session in the Alpha Anywhere Interactive window illustrates the point.
- Variable Scoping and Nested WITH ... END WITH Commands
When you nest WITH ... END WITH commands, it is important to understand how Xbasic treats variables DIMmed in different name-spaces. If a WITH ... END WITH command is nested within another WITH ... END WITH construct, the inner name-space is called the child name-space and the outer name-space is the parent name-space. Any variable that is DIMmed in the parent name-space will be visible in the child name-space. Any variable that is DIMmed in the child name-space will not be visible in the parent name-space (unless the variable name is prefixed with the name-space name, as in: name-space.variable ). The following Xbasic script demonstrates this. In this script, "A" is the parent name-space and "B" is the child name-space. The variable, firstname is DIMmed in the parent name-space. It is therefore visible in the child name-space.
- Working with .Net Arrays
Arrays in Xbasic use one-based indexing. In other programming languages, arrays are zero-indexed. In this guide, you will learn how to work with .Net arrays in Xbasic.
- Xbasic Features
Alpha Anywhere now supports GUIDs as an intrinsic Xbasic data type (designated as type 'K'), just as Character, Numeric, Logical, Time, etc. are intrinsic Xbasic data types. Support for GUID data types is important for Active-Link tables as some SQL databases use GUIDS for primary keys. You can DIM a variable as a GUID, (e.g. DIM varname as K), or you can use the curly bracket notation to specify a value of type 'K' (just as curly bracket notation is used to specify a Date value). The following Interactive window session shows examples: