Referring to sub-array in SC_LOOKUP RS

I have the following function:

$check_sql = “SELECT *”
. " FROM class_template"
. " WHERE id = ‘" . {template} . "’";

sc_lookup(rs, $check_sql);

if (isset({rs[0][0]})) // Row found <<<<------- This is the line I’m referring to below!
{
{title} = {rs[0][3]}; // <<<<------- This is the line I’m referring to below!
// {other_region} = {rs[0][1]};
}
else // No row found
{
{title} = ‘Not Valid’;
//{other_region} = ‘’;
}

The line that says “This is the line I’m referring too”, it has {rs[0][3]}, is there a way of referring to the column name instead of referring to it by number (3)???

Re: Referring to sub-array in SC_LOOKUP RS

I do not believe there is. I have talked with support about adding this, but I not sure the idea took. Seems silly to have to reference a field by a number. You could create a companion array w/ the same number of elements that have field names and reference that after you copy the data … cheesy … very.

Regards,
Scott.

Re: Referring to sub-array in SC_LOOKUP RS

Thanks Scott… didn’t think there was… but thought I’d ask more of an expert lol

Yeah, because if the schema changes, its not very fluid… thanks!

Re: Referring to sub-array in SC_LOOKUP RS

Hello,

You could use sc_select instead and manipulate the dataset yourself.

regards,
Bernhard Bernsmann