Introduction

Overview / Layout

Panels

FileSystem

File Operations

Extensions

Tools

Customization and Configuration

Configuring the Layout

User Commands and Scripting

Other

API

Troubleshooting

FAQ (pages to follow)

Index

MultiScript - Core Functions - RowList functions

The RowList functions are special functions to make it easier to work with text lists.

Example

Suppose the content of the file "d:\temp\list.txt" looks like the following:

Person Z	0202-1111111	Fake Street 1
Person A	0202-2222222	Fake Street 2
Person B	0303-3333333	Fake Street 3
Person C	0202-4444444	Fake Street 4
Person D	0202-5555555	Fake Street 5

The columns are separated with a tab character "\t".  

This script will load that file into a rowlist and then get each column item one-by-one.

@var $list = RowListLoad("d:\\temp\\list.txt", "\t");
@var $rowcnt = RowListCount($list);
@var $idx = 0;
for( $idx = 0; $idx < $rowcnt; $idx++)
{
 @var $Name   = RowListItem($list, $idx, 0)); 
 @var $Phone  = RowListItem($list, $idx, 1)); 
 @var $Street = RowListItem($list, $idx, 2)); 
}

RowList Functions

RowListLoad Load a rowlist
RowListClose Close a rowlist
RowListCount Get the number of rows in the rowlist
RowListColumnCount Get the number of columns
RowListArray Return a specifed row as an array
RowListItem Get a row item.
ReplaceTagsInString Replace the tags in a string with values from a rowlist.

RowListLoad

Load a file as a rowlist.

<handle> RowListLoad(<str> filename, <str> delimiter);

Parameters

filename
File to load as a rowlist
delimiter
Columns are split using this character.

Return value

A handle to a rowlist, or 0 if the load failed.

RowListClose

Close a rowlist

<num> RowListClose(<handle>);

Parameters

handle
Handle to a rowlist

Return value

1 for success, 0 for failure.

RowListCount

Count the number of rows in a list

<num> RowListCount(<handle>);

Parameters

handle
Handle to a rowlist

Return value

The number of rows in the list.

RowListColumnCount

Count the number of columns in a list.

<num> RowListColumnCount(<handle>);

Parameters

handle
Handle to a rowlist

Return value

The number of columns in the list.

RowListArray

Get a row from a list as an array

<array> RowListArray(<handle> <num> row);

Parameters

handle
Handle to a rowlist
row
Index of the row to return as an array.

Return value

An array with all the columns of the specified row.

RowListItem

Get a single item from a list.

<string> RowListItem(<handle> <num> row, <num> col);

Parameters

handle
Handle to a rowlist
row
Row index
col
Column index

Return value

The value of the specified column in the specified row.

ReplaceTagsInString

Replace tags in a string with values from a rowlist

<string> RowListItem(<str> tagString, <str> tag, <handle> rowlist, <handle> rowIdx);

Parameters

tagString
A string with tag that should be replace with values from the rowlist
tag
The tags used in tagString
rowlist
Handle to a rowlist
rowIdx
Index of what row to use when replacing values in string

Return value

A string with tags replaced with values from the rowlist

Example

@var $list = RowListLoad("d:\\temp\\list.txt", "\t");

@var $strTemplate = "Name : %%TAG0%% - Address : %%TAG2%% - Phone : %%TAG1%%";
@var $rowIdx = 0;

@var $strOutput = ReplaceTagsInString($str, "%%TAG(#)%%", $list, $rowIdx);

// $strOutput == "Name : Person Z - Address : Fake Street 1 - Phone : 0202-1111111"