mavtech
Posts: 133
|
| Posted: 04/15/2004, 7:13 AM |
|
I have a checkbox list that is coming from a different table of data and I wish to filter it in the grid by product.
As each row of the grid automatically brings up the next product. How do I access and display only items related to the product_id in that row.
I seem to be having a syntax issue. What is the field name for the CURRENT product_id.
Where clause is something like
attribute_table.product_id = ??Currentproduct_id???
|
 |
 |
sebastian
Posts: 15
|
| Posted: 04/15/2004, 12:54 PM |
|
Try using:
$GLOBALS["formname"]->ds->f("product_id")
as the source of the listbox list control's parameter.
Replace formname with the real name of your grid.
Sebastian
|
 |
 |
mavtech
Posts: 133
|
| Posted: 04/15/2004, 8:01 PM |
|
Thank you for assistance but it did not work.
Maybe I am using it wrong. I put it in the properties - data - control source area.
Is that right ? do I also have to put it in the where clause.
When I try I get errors.
$GLOBALS["products"]->ds->f("product_id") = product_to_attributes.product_id
I am very new at this.
Thanks for any help you can give me
|
 |
 |
peterr
Posts: 5971
|
| Posted: 04/16/2004, 12:21 AM |
|
I think that you should put this code in the Where/Parameters area of your Data Source for the listbox. This looks like what you've done but please double-check. Open the "Data Source" dialog for the listbox, click on the "+" to create new parameter, then add this code in the "Parameter source" field. You will also need to change Parameter type to "Expression".
If you see an error later, please post it here as it may help in determining what's wrong.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
mavtech
Posts: 133
|
| Posted: 04/16/2004, 6:48 PM |
|
error I get is:
Fatal error: Call to a member function on a non-object in c:\program files\easyphp1-7\www\mavericknew\productseducation.php on line 266
|
 |
 |
peterr
Posts: 5971
|
| Posted: 04/16/2004, 10:34 PM |
|
I checked and it looks like sebastian's solution will not work. To improve performance the ListBox code is executed only once, therefore the Where statement cannot be different for each row in the grid. Executing the listbox with different Where statement in each row would make the Grid very slow, therefore we do not support such logic by default.
Your options could be to use JavaScript to filter the listboxes somehow, or use some code in the event of the ListBox to limit the list of values being displayed in the listbox for each grid row.
Unfortunately I have never worked with such functionality. Possibly someone else has sample code and will share.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
mavtech
Posts: 133
|
| Posted: 04/20/2004, 6:30 PM |
|
Peter,
I do want to use the same where clause but I need to access the Product ID of each row. Will that work ?
|
 |
 |
mavtech
Posts: 133
|
| Posted: 04/20/2004, 9:29 PM |
|
I may not be describing it very clearly.
In each row of the product table I can easily get the product_ID to show
1 for Product A
2 for Product B
I want to use that CURRENT product ID in my where clause row by row.
How do I access that product_id I have tried $product_id etc etc
Could you give me the syntax of where it is stored. The name
My where clause is simple for the checkbox list.
store_product_attributes.product_id = ???????
Thanks again for any help you can provide me.
Paul
|
 |
 |
peterr
Posts: 5971
|
| Posted: 04/21/2004, 12:25 AM |
|
I think that I understand your objective and my previous answer still applies. The ListBox cannot be automatically changed on row-by-row basis (in the Grid) because it would require multiple executions of the ListBox code, which would slow down the application a lot. You want each ListBox to display different values, for different product_ID, right? This means that if you have 20 rows then you'd have 20 ListBoxes, each with different values, even if from the same database table. This would take long time to execute since you'd need to run 20 extra database queries on one page.
However, you may be able to use Events (custom code) to achieve this. I see that you already submitted a support request therefore I'll check if our support can provide you with a code sample. This solution may work slowly though.
Another, fast method would be to display the full ListBox in all grid rows, then filter it using JavaScript/DHTML. I couldn't get an example for this though because it is not directly related to CCS. You may need to refer to JavaScript documentation and references on the Internet.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
mavtech
Posts: 133
|
| Posted: 05/25/2004, 8:13 AM |
|
Still working on this can anyone help.
|
 |
 |
Noboo
|
| Posted: 06/20/2005, 8:45 AM |
|
I need the solution for this question. Anyone can help? Thanks in advance.
|
|
|
 |
diligentman
Posts: 7
|
| Posted: 09/09/2005, 9:06 PM |
|
Nice to know that I had already figured out how the grid worked with a filtered list box before I read Peterr's explanation. Now the question is HOW do you filter the table efficiently? (using VB)
Diligentman
_________________
DiligentMan,
Northern Colorado |
 |
 |