btphelps
10-19-2007, 09:01 PM
I'm not a programmer, so please bear with me as I describe this issue.
Our query is ignoring database entries with different IDs but the same names and only displaying one. We need it to display both.
For example, we have two rose products:
2454 Coffee Bean Mini Modern Bush
2523 Coffee Bean Mini 18" Tree
Using Lasso, the application builds a query for all roses that are available,
whose price code is not blank, gets the product name, and builds the results list:
$WhereStatement = (TC_SQLBuildWhere:
-Column='rosetypes.availability',
-Value='"NA%"',
-Op=' NOT LIKE ',
-SQLStatement=$WhereStatement);
$WhereStatement = (TC_SQLBuildWhere:
-Column='rosetypes.price_code',
-Value='""',
-Op=' NOT LIKE ',
-SQLStatement=$WhereStatement);
$WhereStatement = (TC_SQLBuildWhere:
-Column='roses.name',
-Value=('"' + (Action_Param: 'name') + '%' + '"'),
-Op=' LIKE ',
-SQLStatement=$WhereStatement);
If: $WhereStatement != '';
$SQLStatement += ' WHERE ' + $WhereStatement + ' ORDER BY name;';
/If;
Inline:
-ClientUsername=$SystemDatabaseUser,
-ClientPassword=$SystemDatabasePassword,
-Database=$SystemDatabase,
-MaxRecords='24',
-SkipRecords=$SystemSkipRecords,
-SQL=$SQLStatement,
'name'=(Action_Param: 'name');
'class'=(Action_Param: 'class'),
'ars_color'=(Action_Param: 'ars_color');
'aars_winner' = (Action_Param: 'aars_winner')
var: 'RoseType' = (Action_Param: 'type'),
var: 'RoseClass' = (Action_Param: 'class');
var: 'aars_winner' = (Action_Param: 'aars_winner');
Var: 'SystemNavResultsNoSort' = false;
Var: 'SystemNavResultsNoMaxRecords' = false;
// display the records identified
Include: 'search_list.lasso';
The file search_list.lasso loops through the query as follows:
$CurrentRepetition += 1;
Inline:
-ClientUsername=$SystemDatabaseUser,
-ClientPassword=$SystemDatabasePassword,
-Database=$SystemDatabase,
-Table='rosetypes',
-Table='classes',
-Op='eq', 'rose_id'=(Field: 'ID'),
-SortField='code',
-Search;
Var: 'image_code' = (Field: 'code');
/Inline;
Var: 'currentImageThumb' = 'images/thumbnail/th_' + (Var: 'image_code') + '.gif';
Inline:
-ClientUsername=$SystemDatabaseUser,
-ClientPassword=$SystemDatabasePassword,
-Nothing;
Var: 'currentImageThumbExists' = (File_Exists: $currentImageThumb);
/Inline;
?>
// formats the display as a table etc
<TD VALIGN="top" HEIGHT="40">
<A HREF="detail.lasso?ID=[Field: 'ID']">[Field: 'name']</A>
<br>
[var: 'RoseClass']<br>
[var: 'RoseType']<br>
[var: 'aars_winner']
</TD>
// ends the formatting of the results
</TR><TR>
// yadda-yadda...
</TR>
[$CurrentRepetition = 0]
You can see the results of this here:
http://www.regannursery.com/roses/browse.lasso?name=C&SystemSkipRecords=48
So I'm at a loss as to how to make the query get both entries for Coffee Bean to display.
I'd appreciate any pointers you might offer.
Brian Phelps
www.phelpstek.com
Our query is ignoring database entries with different IDs but the same names and only displaying one. We need it to display both.
For example, we have two rose products:
2454 Coffee Bean Mini Modern Bush
2523 Coffee Bean Mini 18" Tree
Using Lasso, the application builds a query for all roses that are available,
whose price code is not blank, gets the product name, and builds the results list:
$WhereStatement = (TC_SQLBuildWhere:
-Column='rosetypes.availability',
-Value='"NA%"',
-Op=' NOT LIKE ',
-SQLStatement=$WhereStatement);
$WhereStatement = (TC_SQLBuildWhere:
-Column='rosetypes.price_code',
-Value='""',
-Op=' NOT LIKE ',
-SQLStatement=$WhereStatement);
$WhereStatement = (TC_SQLBuildWhere:
-Column='roses.name',
-Value=('"' + (Action_Param: 'name') + '%' + '"'),
-Op=' LIKE ',
-SQLStatement=$WhereStatement);
If: $WhereStatement != '';
$SQLStatement += ' WHERE ' + $WhereStatement + ' ORDER BY name;';
/If;
Inline:
-ClientUsername=$SystemDatabaseUser,
-ClientPassword=$SystemDatabasePassword,
-Database=$SystemDatabase,
-MaxRecords='24',
-SkipRecords=$SystemSkipRecords,
-SQL=$SQLStatement,
'name'=(Action_Param: 'name');
'class'=(Action_Param: 'class'),
'ars_color'=(Action_Param: 'ars_color');
'aars_winner' = (Action_Param: 'aars_winner')
var: 'RoseType' = (Action_Param: 'type'),
var: 'RoseClass' = (Action_Param: 'class');
var: 'aars_winner' = (Action_Param: 'aars_winner');
Var: 'SystemNavResultsNoSort' = false;
Var: 'SystemNavResultsNoMaxRecords' = false;
// display the records identified
Include: 'search_list.lasso';
The file search_list.lasso loops through the query as follows:
$CurrentRepetition += 1;
Inline:
-ClientUsername=$SystemDatabaseUser,
-ClientPassword=$SystemDatabasePassword,
-Database=$SystemDatabase,
-Table='rosetypes',
-Table='classes',
-Op='eq', 'rose_id'=(Field: 'ID'),
-SortField='code',
-Search;
Var: 'image_code' = (Field: 'code');
/Inline;
Var: 'currentImageThumb' = 'images/thumbnail/th_' + (Var: 'image_code') + '.gif';
Inline:
-ClientUsername=$SystemDatabaseUser,
-ClientPassword=$SystemDatabasePassword,
-Nothing;
Var: 'currentImageThumbExists' = (File_Exists: $currentImageThumb);
/Inline;
?>
// formats the display as a table etc
<TD VALIGN="top" HEIGHT="40">
<A HREF="detail.lasso?ID=[Field: 'ID']">[Field: 'name']</A>
<br>
[var: 'RoseClass']<br>
[var: 'RoseType']<br>
[var: 'aars_winner']
</TD>
// ends the formatting of the results
</TR><TR>
// yadda-yadda...
</TR>
[$CurrentRepetition = 0]
You can see the results of this here:
http://www.regannursery.com/roses/browse.lasso?name=C&SystemSkipRecords=48
So I'm at a loss as to how to make the query get both entries for Coffee Bean to display.
I'd appreciate any pointers you might offer.
Brian Phelps
www.phelpstek.com