Wiki Home

Alias


Namespace: Wiki
Why does parameter cTableAlias exist?

Probably because using nWorkArea you can get the alias of a specific work area, and everywhere you can use nWorkArea, cTableAlias is implicitly included. No big deal -- Mike Helland

Consider the function:

FUNCTION Foo
LPARAMETER uWorkArea

SELECT 0
USE ALIAS(uWorkArea) AGAIN ALIAS Alias2
[whatever else]

This function could be called with either the work area number or table alias as an argument. - RushStrong

ALIAS( ) Function
Returns the table alias of the current or specified work area.

Syntax
ALIAS([nWorkArea | cTableAlias])

So,
SELECT 5
USE Customer ALIAS Test123
? ALIAS()
  Test123
SELECT 10
? Alias()

? Alias(5)
  Test123
? Alias("Test123")  && This simply prints out the parameter (probably not *so* simple inside the function, but that's all that results)
  Test123
USE IN 5
? Alias("Test123")  && This generates "Alias Not Found" error!


? Alias(25) && Does not generate an error.


Category Code Samples Category VFP Functions
( Topic last updated: 2008.01.14 03:34:07 PM )