Fullscreen
Loading...
 
[Show/Hide Left Column]
[Show/Hide Right Column]

Print

TABLE.EXTERNAL_RECORD_CONTENT_GET()

Syntax

String as C = TABLE.EXTERNAL_RECORD_CONTENT_GET( Table_Name as C, Content_Expn as C [, Order_Expn as C [, Filter_Expn as C ]] )

Argument

Description

Table_Name

The table that contains the records you wish to retrieve.

Content_Expn

An expression that processes the records that are selected and returns a character value.

Order_Expn

Optional. Default = "" (record number order). A character order expression that sorts selected records.

Filter_Expn

Optional. Default = All records. A character filter expression that evaluates to a logical value. Selects records from the table.

Description

The TABLE.EXTERNAL_RECORD_CONTENT_GET() method creates a CR-LF delimited string of values from a table. The values in the string are obtained by evaluating the Content_Expn for each record in the table that satisfies the Filter_Expn. The order of the values in the string is specified by the Order_Expn.

This method is very useful if you have to populate an array with values from a table.

Note : When working with a table that is already open, <TBL>.RECORD_CONTENT_GET() is faster.

Example

The following script populates an array with the first and last names of people in Massachusetts from the Customer table.

dim names[100] as C

list = table.external_record_content_GET("customer", "alltrim(firstname) + ' ' + lastname", "lastname",

"state = 'ma'")

names.initialize(list)

This function returns nothing because the Content_Expn (in this case the 'date' field) returns a Date type.

? table.external_record_content_get("invoice_header","date","","")

= ""

Here we use the dtoc() function to transform the content_expn to a character type.

? table.external_record_content_get("invoice_header", "dtoc(Date)", "", "")

= 01/10/2002

01/10/2002

01/11/2002

01/11/2002

01/12/2002

In this example, its hard to see what i have done, but I have prefixed the content expression with a NULL string ( '' -- two single quotes). this makes the content_expression return a character value.

? table.external_record_content_get("invoice_header", "'' + date", "", "")

= 01/10/2002

01/10/2002

01/11/2002

01/11/2002

01/12/2002

01/12/2002

This technique of prefixing a value with a NULL string to transform it to a character value is new in V5 (i.e. could not be done in v4.5). it is very useful.

? '"" + date()'

"01/24/2004"

See Also

Table Functions and Methods, <ARRAY>.INITIALIZE(), Writing Expressions

Supported By

Alpha Five Version 5 and Above


Created by admin. Last Modification: Tuesday 01 of October, 2013 09:23:23 EDT by cianchambliss.

Print