table.POPULATE_FROM_STRING Function

Syntax

V Populate_From_String(C record_format,C record_sep,C record_data)

Arguments

record_formatCharacter

A (comma) delimited list of field names. The delimiter must match what is used in the data, which is most often a comma.

record_sepCharacter

The character or expression that separates records in the Data field.

record_dataCharacter

Data to place into the table.

Description

Populate a table from a string.

Discussion

The <TBL>.POPULATE_FROM_STRING() method populates an existing table from a string variable.

Example

data = <<%a%
tom,23334.56,12/18/52,.t.
fred,23412.345,12/10/72,.f.
%a%
t = table.open("testtable")
t.populate_from_string("name,salary,dob,married", crlf(), data)
t.close()

The above example adds two new records to a table called "testtable":

images/testTableValues.png

The table, "testtable", is a table with character, numeric, date, and logical fields (shown in the image below.)

images/ME_TBL_POPULATE_FROM_STRING.gif

See Also